• Resolved dwooly824

    (@dwoolworth824)


    I’d like the “More Projects” (at the bottom of individual project posts) to navigate to the previous and next project within the same project category. The default is to navigate by project post date.

    I believe that template-tags.php is the file to edit, but I’m not sure how to adjust the code. Or if this is possible. Here’s a link to my dev site. Thanks for looking.

    function sketch_portfolio_pagination() {
    	global $post;
    	$pagination_posts = array();
    
    	$pagination_posts['previous'] = get_adjacent_post( false, '', true );
    	$pagination_posts['current']  = get_post();
    	$pagination_posts['next']     = get_adjacent_post( false, '', false );
    
    	if ( ! $pagination_posts['previous'] && ! $pagination_posts['next'] )
    		return false;
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Have a look at the taxonomy variable in the get_adjacent_post function:

    https://codex.wordpress.org/Function_Reference/get_adjacent_post

    Also just a heads-up that since you renamed the theme folder and didn’t use a child theme (unless I’m missing it, in which case just ignore this!) I don’t think you’ll get notifications to update Sketch, and won’t be able to update it in the usual way you’d update a theme from the directory. Ideally you should create a child theme in which you isolate all your theme customizations so you don’t lose them, but also still benefit from updates to the parent theme.

    Thread Starter dwooly824

    (@dwoolworth824)

    Hi Kathryn,
    I’ll play around with this and see if I figure it out; I’m not much of php developer. Thanks for responding!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘More Projects sorted by project category instead of post date’ is closed to new replies.