Changeset 7835 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
- Timestamp:
- 11/08/2018 10:12:38 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
r7775 r7835 27 27 } 28 28 add_action( 'wp_enqueue_scripts', 'wporg_support_scripts' ); 29 30 /** 31 * Register widget areas used by the theme. 32 * 33 * @uses register_sidebar() 34 */ 35 function 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 } 51 add_action( 'widgets_init', 'wporg_support_register_widget_areas' ); 29 52 30 53 /** … … 127 150 $classes[] = 'wporg-responsive'; 128 151 $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 129 164 return $classes; 130 165 } 131 166 add_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 */ 175 function wporg_support_excerpt_length( $length ) { 176 if ( is_archive() ) { 177 return 25; 178 } 179 180 return $length; 181 } 182 add_filter( 'excerpt_length', 'wporg_support_excerpt_length' ); 132 183 133 184 /**
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)