Wordpress template next_prev

I have next and prev with a gallery and the select is not ok and I have no idea how to change. I want to make the select by two category not by a status (publish)

function in_conference_prev_next_posts() {
    $cmsmasters_post_type = get_post_type();

    $published_posts = wp_count_posts($cmsmasters_post_type)-publish;


    if ($published_posts  1) {
        echo 'aside class="post_nav"';

        previous_post_link('span class="cmsmasters_prev_post"%linkspan class="cmsmasters_prev_arrow"span/span/spanspan class="sub"previous/span/span');

        next_post_link('span class="cmsmasters_next_post"%linkspan class="cmsmasters_next_arrow"span/span/spanspan class="sub"next/span/span');

        echo '/aside';
    }
}

Topic next posts Wordpress

Category Web


See: https://codex.wordpress.org/Function_Reference/previous_post_link

I'm a little confused by what you are asking but I'm assuming you are after the next/prev links to go to the next or previous post in the same category? In which case, you need to define the third argument in 'previous_post_link' & 'next_post_link' as 'true'.

Note that those two functions must be used inside "the loop" to work.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.