• I’m trying to get my prev/next in category links to match the style of the theme, which uses this:

    if ( ! function_exists( 'first_post_nav' ) ) :
    /**
     * Display navigation to next/previous post when applicable.
     */
    function first_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', 'first' ); ?></h1>
    		<div class="nav-links">
    			<?php
    				previous_post_link( '<div class="nav-previous"><div class="post-nav-title">' . __( 'Previous post', 'first' ) . '</div>%link</div>', _x( '%title', 'Previous post link', 'first' ) );
    				next_post_link(     '<div class="nav-next"><div class="post-nav-title">' . __( 'Next post', 'first' ) . '</div>%link</div>', _x( '%title', 'Next post link', 'first' ) );
    			?>
    		</div><!-- .nav-links -->
    	</nav><!-- .navigation -->
    	<?php
    }
    endif;

    Is that code editable to display prev/next in cat rather than just prev/next links?

The topic ‘Prev/next in same category’ is closed to new replies.