Changeset 5913 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
- Timestamp:
- 09/12/2017 04:49:49 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
r5820 r5913 117 117 add_theme_support( 'post-thumbnails' ); 118 118 119 add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_items', 10, 2 ); 119 // Modify default breadcrumbs. 120 add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_items_for_hooks', 10, 2 ); 121 add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_items_for_handbook_root', 10, 2 ); 120 122 121 123 add_filter( 'wp_parser_skip_duplicate_hooks', '__return_true' ); … … 143 145 * 144 146 * @param array $items The breadcrumb trail items 145 * @param array $args Original arg 147 * @param array $args Original args 146 148 * @return array 147 149 */ 148 function breadcrumb_trail_items ( $items, $args ) {150 function breadcrumb_trail_items_for_hooks( $items, $args ) { 149 151 $post_type = 'wp-parser-hook'; 150 152 … … 162 164 // Unset the last element since it shifted up in trail hierarchy 163 165 unset( $items[4] ); 166 167 return $items; 168 } 169 170 /** 171 * Fix breadcrumb for handbook root pages. 172 * 173 * The handbook root/landing pages do not need a duplicated breadcrumb trail 174 * item that simply links to the currently loaded page. The trailing breadcrumb 175 * item is already the unlinked handbook name, which is sufficient. 176 * 177 * @param array $items The breadcrumb trail items 178 * @param array $args Original args 179 * @return array 180 */ 181 function breadcrumb_trail_items_for_handbook_root( $items, $args ) { 182 // Bail early if not a handbook landing page. 183 if ( ! function_exists( 'wporg_is_handbook_landing_page' ) || ! wporg_is_handbook_landing_page() ) { 184 return $items; 185 } 186 187 // Unset link to current handbook. 188 unset( $items[1] ); 164 189 165 190 return $items;
Note: See TracChangeset
for help on using the changeset viewer.