Hello World! Today Innovative is here to add some function to post and make them like tender to shuffle between posts and limit posts to the Specific category with the title.

WordPress FunctionsΒ  used:

# get_adjacent_post
# get_permalink
# get_the_category();
#Β $prev_post
# $next_post
# my_custom_post_navigation

Steps to limit posts to the Specific Category with the title:

1. Go to your theme single.php [Some theme have template parts so try to find the exact location]
in my case I was working with Flatsome WordPress Theme, So it’s directory is {Public_html/wp-content/themes/template-parts/posts/content-single.php}.

2. Copy Paste the below code to content-single.php.

< div class="post-limited-navigations">
	ID; // Get current post ID
$cat = get_the_category(); 
$current_cat_id = $cat[0]->cat_ID; // Get current Category ID 

$args = array('category'=>$current_cat_id,'orderby'=>'post_date','order'=> 'DESC');
$posts = get_posts($args);
// Get IDs of posts retrieved by get_posts function
$ids = array();
foreach ($posts as $thepost) {
    $ids[] = $thepost->ID;
// Get and Echo the Previous and Next post link within same Category
$index = array_search($post->ID, $ids);
$prev_post = $ids[$index-1];
$next_post = $ids[$index+1];

ID) . '" title="' . $prev_post->post_title . '">Previous: ' . $prev_post->post_title . ''; } ?>

ID) . '" title="' . $next_post->post_title . '">Next: ' . $next_post->post_title . ''; } ?>
< /div>

3. Call the code in function.php of theme

 * Return only the first category when outputting the previous/next post links
function my_custom_post_navigation($terms, $object_ids, $taxonomies, $args){
    return array_slice($terms, 0, 1);

4. Add the style to [Apearance>Customize> Additional Css>]

.post-limited-navigations a {
    width: 50%;
    background: whitesmoke;
    text-align: center;
    border-right: 1px solid #000;
    border-left: 1px solid #000;
    padding: 20px 0px;
    font-size: 18px;
    font-weight: bold;


That’s it!

Hope you have liked the simple tutorial, Don’t forget to comment and share your information in the comment box. I will try my best to give response asap.

Wish you Best of luck!