Changeset 773 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
- Timestamp:
- 07/30/2014 10:08:42 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
r771 r773 49 49 add_action( 'pre_get_posts', __NAMESPACE__ . '\\pre_get_posts' ); 50 50 add_action( 'template_redirect', __NAMESPACE__ . '\\redirect_single_search_match' ); 51 add_action( 'template_redirect', __NAMESPACE__ . '\\redirect_handbook' ); 51 52 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\theme_scripts_styles' ); 52 53 add_filter( 'post_type_link', __NAMESPACE__ . '\\method_permalink', 10, 2 ); … … 63 64 64 65 add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_items', 10, 2 ); 66 add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_remove_handbook', 10, 2 ); 65 67 66 68 treat_comments_as_examples(); … … 94 96 // Unset the last element since it shifted up in trail hierarchy 95 97 unset( $items[4] ); 98 99 return $items; 100 } 101 102 /** 103 * Removes the 'Handbook' segment of the breakcrumb, when present. 104 * 105 * There is no handbook page or listing at present. 106 * 107 * @param array $items The breadcrumb trail items 108 * @param array $args Original arg 109 * @return array 110 */ 111 function breadcrumb_trail_remove_handbook( $items, $args ) { 112 if ( false !== strpos( $items[1], '>Handbook</a>' ) ) { 113 array_splice( $items, 1, 1 ); 114 } 96 115 97 116 return $items; … … 474 493 475 494 /** 495 * Redirects a naked handbook request to home. 496 */ 497 function redirect_handbook() { 498 if ( 'handbook' == get_query_var( 'name' ) && ! get_query_var( 'post_type ' ) ) { 499 wp_redirect( home_url() ); 500 exit(); 501 } 502 } 503 504 /** 476 505 * Makes phpDoc @link references clickable. 477 506 *
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)