• Hi, I am trying to show the featured image of the next and previous post while I am inside a single custom post. So I took the “adjacent post ID” and now I need to work with it inside a WP_Query() loop:

    <?php
    	$adjacent_post = get_adjacent_post(false,'',false) ;
    	$the_ID =  $adjacent_post->ID;
            $progetti_home = new WP_Query('post_type=portfolio');
            while($progetti_home->have_posts()) :                          $progetti_home->the_post();?>
    
            // some code

    How can I put the “$the_ID” var inside the WP_Query brackets to tell the loop only consider the post with that particular ID?

    Thanks!

  • The topic ‘WP_Query and get_adjacent_post()’ is closed to new replies.