Changeset 7218 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/header-child-page.php
- Timestamp:
- 05/23/2018 09:27:18 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/header-child-page.php
r6797 r7218 29 29 <ul> 30 30 <?php 31 $active_item = false; 32 // The last found menu item that patches is the one that's shown as active. 33 foreach ( $menu_items as $path => $text ) { 34 if ( false !== strpos( $_SERVER['REQUEST_URI'], $path ) ) { 35 $active_item = $path; 36 } 37 } 38 31 39 foreach ( $menu_items as $path => $text ) : 32 $class = false !== strpos( $_SERVER['REQUEST_URI'], $path) ? 'active' : ''; // phpcs:ignore40 $class = ( $path === $active_item ) ? 'active' : ''; // phpcs:ignore 33 41 ?> 34 <li class="page_item"><a class="<?php echo esc_attr( $class ); ?>" href="<?php echo esc_url( home_url( $path) ); ?>"><?php echo esc_html( $text ); ?></a></li>42 <li class="page_item"><a class="<?php echo esc_attr( $class ); ?>" href="<?php echo esc_url( trailingslashit( home_url( $path ) ) ); ?>"><?php echo esc_html( $text ); ?></a></li> 35 43 <?php endforeach; ?> 36 44 </ul>
Note: See TracChangeset
for help on using the changeset viewer.