Exclude Current Portfolio Item From Looper On Single Layout

Hi,

I have created a single layout for portfolio items and I have added a post looper at the end of the layout to display more portfolio items. I would like to exclude the current portfolio item from the post looper so that only other portfolio items are shown.

Is there a way to do this in Cornerstone?

Hello @liamsaunders,

Thanks for posting in!

Based on the information that you shared, you will need to use the Looper Provider Query String with the following arguments:

$query = array(
  'post_type'           => 'x-portfolio',
  'posts_per_page'      => 2,
  'offset'              => 0,
  'ignore_sticky_posts' => true,
  'post__not_in'        => array( '{{dc:post:id}}' )
);

This argument would give you the following query string: post_type=x-portfolio&posts_per_page=2&offset=0&ignore_sticky_posts=1&post__not_in%5B0%5D={{dc:post:id}}

and this should display the other portfolio items excluding the current portfolio item

Kindly let us know how it goes.

Hi @ruenel. You’re welcome. Thank you for your Query String solution. It worked perfectly!

Glad that things are well for you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.