Skip Navigation

[Resolved] Filter by the same Custom Post Type

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 1 reply, has 2 voices.

Last updated by Cristina Vidal 6 years, 10 months ago.

Assisted by: Cristina Vidal.

Author
Posts
#541743

I am trying to: Show 4 random Custom Posts from the same PLACE as the selected Custom Post

A View shows a Post.
Below that view, I have placed a 2e View showing 4 random posts.
That works well.

Now I would like to be shown in the 2nd View (under) Posts with the same Custom Field "CITY" as the above post.

I have tried a lot with the Filter, but I do not get it working.

#542063

Dear user,

are the Place and City fields separate custom fields of the same post type that the random posts are referring to?

You could use a condition on your 2nd View that outputs only the posts that have the same City field as the posts of the content you are filtering.

To get the parameter of the City for your condition, you would need to pass this parameter to your second View.

If you use a nested View, with the parent View for the Post and the Child View for the random posts, you could pass that argument.

This documentation could be useful for your case:

https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/nesting-and-combining-conditions/

If this does not help you out, please specify with an example of your code to be able to check if what you are trying to do is possible in the way you are doing it.

Kind regards,

Cristina

The forum ‘Types Community Support’ is closed to new topics and replies.

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