Making WordPress.org


Ignore:
Timestamp:
11/08/2018 10:12:38 AM (8 years ago)
Author:
netweb
Message:

Support Forum: Updated bbPress templates and styles

See #3485.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r7775 r7835  
    2727}
    2828add_action( 'wp_enqueue_scripts', 'wporg_support_scripts' );
     29
     30/**
     31 * Register widget areas used by the theme.
     32 *
     33 * @uses register_sidebar()
     34 */
     35function wporg_support_register_widget_areas() {
     36        register_sidebar( array(
     37                'name'          => __( 'Front page blocks', 'wporg-forums' ),
     38                'id'            => 'front-page-blocks',
     39                'description'   => __( 'Contains blocks to display on the front page of this site', 'wporg-forums' ),
     40                'before_widget' => '<div id="%1$s" class="widget %2$s">',
     41                'after_widget'  => '</div>',
     42        ) );
     43        register_sidebar( array(
     44                'name'          => __( 'HelpHub Sidebar', 'wporg-forums' ),
     45                'id'            => 'helphub-sidebar',
     46                'description'   => __( 'Contains blocks to display on HelpHub articles', 'wporg-forums' ),
     47                'before_widget' => '<div id="%1$s" class="widget %2$s">',
     48                'after_widget'  => '</div>',
     49        ) );
     50}
     51add_action( 'widgets_init', 'wporg_support_register_widget_areas' );
    2952
    3053/**
     
    127150        $classes[] = 'wporg-responsive';
    128151        $classes[] = 'wporg-support';
     152
     153        // Add specific classes to HelpHub pages.
     154        $helphub_post_types = array( 'helphub_article', 'helphub_version' );
     155        if ( is_singular( $helphub_post_types ) ||
     156                is_post_type_archive( $helphub_post_types ) ) {
     157                $classes[] = 'helphub-page';
     158        }
     159
     160        if ( is_active_sidebar( 'helphub-sidebar' ) ) {
     161                $classes[] = 'helphub-with-sidebar';
     162        }
     163
    129164        return $classes;
    130165}
    131166add_filter( 'body_class', 'wporg_support_body_class' );
     167
     168/**
     169 * Change the amount of words allowed in excerpts on archive listings.
     170 *
     171 * @param int $length
     172 *
     173 * @return int
     174 */
     175function wporg_support_excerpt_length( $length ) {
     176        if ( is_archive() ) {
     177                return 25;
     178        }
     179
     180        return $length;
     181}
     182add_filter( 'excerpt_length', 'wporg_support_excerpt_length' );
    132183
    133184/**
Note: See TracChangeset for help on using the changeset viewer.