Changeset 2508
- Timestamp:
- 02/15/2016 10:38:48 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r2437 r2508 65 65 <?php previous_post_link( '%link', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'wporg' ) ); ?> 66 66 <?php next_post_link( '%link', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'wporg' ) ); ?> 67 68 </div>69 <!-- .nav-links -->70 </nav><!-- .navigation -->71 <?php72 }73 endif;74 75 if ( ! function_exists( 'wporg_developer_post_nav_via_menu' ) ) :76 /**77 * Outputs previous and/or next post navigation links using the78 * specified menu to inform navigation ordering.79 *80 * @param string $menu_name The name of the menu to use for nav ordering.81 */82 function wporg_developer_post_nav_via_menu( $menu_name ) {83 // Get the items for the specified menu84 if ( ! $menu_items = wp_get_nav_menu_items( $menu_name ) ) {85 return;86 }87 88 // Get ids for all menu objects89 $menu_ids = wp_list_pluck( $menu_items, 'object_id' );90 91 // Get current post92 if ( ! $post = get_post() ) {93 return;94 }95 96 // Index of current post in menu. Return if not in menu.97 $i = array_search( $post->ID, $menu_ids );98 if ( false === $i ) {99 return;100 }101 102 // Find the previous post (note: preview menu item may not be a post)103 $previous = null;104 for ( $n = $i-1; $n >= 0; $n-- ) {105 if ( isset( $menu_items[ $n ] ) && is_a( $menu_items[ $n ], 'WP_Post' ) ) {106 $previous = $menu_items[ $n ];107 break;108 }109 }110 111 // Find the next post (note: next menu item may not be a post)112 $next = null;113 $max = count( $menu_items );114 for ( $n = $i+1; $n < $max; $n++ ) {115 if ( isset( $menu_items[ $n ] ) && is_a( $menu_items[ $n ], 'WP_Post' ) ) {116 $next = $menu_items[ $n ];117 break;118 }119 }120 121 if ( ! $previous && ! $next ) {122 return;123 }124 ?>125 126 <nav class="navigation post-navigation" role="navigation">127 <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'wporg' ); ?></h1>128 <div class="nav-links">129 130 <?php131 if ( $previous ) {132 printf( '<a href="%s" rel="previous"><span class="meta-nav">←</span> %s</a>',133 esc_url( $previous->url ),134 esc_html( $previous->title )135 );136 }137 138 if ( $next ) {139 printf( '<a href="%s" rel="next">%s <span class="meta-nav">→</span></a>',140 esc_url( $next->url ),141 esc_html( $next->title )142 );143 }144 ?>145 67 146 68 </div> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss
r2436 r2508 1329 1329 } 1330 1330 1331 nav. post-navigation .nav-links a {1331 nav.handbook-navigation .nav-links a { 1332 1332 width: 49%; 1333 1333 display: inline-block; -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single-plugin-handbook.php
r922 r2508 18 18 <?php get_template_part( 'content', 'handbook'); ?> 19 19 20 <?php wporg_developer_post_nav_via_menu( 'Plugin Table of Contents' ); ?>20 <?php \WPorg_Handbook_Navigation::navigate_via_menu( 'Plugin Table of Contents' ); ?> 21 21 22 22 <?php endwhile; // end of the loop. ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single-theme-handbook.php
r922 r2508 18 18 <?php get_template_part( 'content', 'handbook'); ?> 19 19 20 <?php wporg_developer_post_nav_via_menu( 'Theme Table of Contents' ); ?>20 <?php \WPorg_Handbook_Navigation::navigate_via_menu( 'Theme Table of Contents' ); ?> 21 21 22 22 <?php endwhile; // end of the loop. ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css
r2436 r2508 1438 1438 width: 100%; 1439 1439 } 1440 .devhub-wrap nav. post-navigation .nav-links a {1440 .devhub-wrap nav.handbook-navigation .nav-links a { 1441 1441 width: 49%; 1442 1442 display: inline-block; 1443 1443 } 1444 .devhub-wrap nav. post-navigation .nav-links a[rel="prev"] {1444 .devhub-wrap nav.handbook-navigation .nav-links a[rel="prev"] { 1445 1445 text-align: left; 1446 1446 } 1447 .devhub-wrap nav. post-navigation .nav-links a[rel="next"] {1447 .devhub-wrap nav.handbook-navigation .nav-links a[rel="next"] { 1448 1448 text-align: right; 1449 1449 float: right;
Note: See TracChangeset
for help on using the changeset viewer.