previous_post_link and next_post_link by category
-
I have been unable to get my themes
template-tags.php
to be replaced by child theme functions so that they only link within a categoryCurrent code of
template-tags.php
function twentyfourteen_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentyfourteen' ); ?></h1> <div class="nav-links"> <?php if ( is_attachment() ) : previous_post_link( '%link', __( '<span class="meta-nav">Published In SOMETHING A</span>%title', 'twentyfourteen' ) ); else : previous_post_link( '%link', __( '<span class="meta-nav">Previous Post NOT THIS B</span>%title', 'twentyfourteen' ) ); next_post_link( '%link', __( '<span class="meta-nav">Next Post WACKY C</span>%title', 'twentyfourteen' ) ); endif; ?> </div><!-- .nav-links --> </nav><!-- .navigation -->
I am unclear as to what I need to add to child functions.php to get the result I am looking for. I have also tried to change false to true per WP prev link codex. It will correct the prev link but not the next link.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘previous_post_link and next_post_link by category’ is closed to new replies.