Title: Prev/next in same category
Last modified: August 22, 2016

---

# Prev/next in same category

 *  [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/prevnext-in-same-category/)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [gulliver](https://wordpress.org/support/users/gulliver/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/prevnext-in-same-category/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
