Skip Navigation

[Résolu] Using • Don't include current page in query result • on intermediary post

This support ticket is created Il y a 3 années et 1 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

Marqué : ,

This topic contains 16 réponses, has 2 voix.

Last updated by Stephen Vaughan Il y a 3 années et 1 mois.

Assisted by: Jamal.

Auteur
Publications
#1989347

Jamal
Supporter

Languages: Anglais (English ) Français (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Actually, I had a logic mistake in my suggested code. get_the_ID() will return the ID of the current post, which is the intermediary post. We need to exclude the product post, which is the child post. The following code works as expected:

function other_exhibits_shortcode_function() {
  $parent_id = do_shortcode('[wpv-post-id item="@exhibition-work.parent"]');
  $child_id = do_shortcode('[wpv-post-id item="@exhibition-work.child"]');
  return do_shortcode('[wpv-view name="other-exhibition-works" parentpost="' . $parent_id . '" posttoexclude ="' . $child_id. '"]');
}

add_shortcode('other-exhibits', 'other_exhibits_shortcode_function');

Now it returns only 5 posts instead fo 6. hidden link

#1989415

Thanks Jamal,

Bon travail!

I will go over this solution and try to learn from it.

I see I also had the shortcode in the top template as well. Reason why we are seeing things three times.

You might have seen the site crash there as well earlier on. I was experimenting with another function elsewhere on the site. Apologies for that.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.