Skip Navigation

[Resolved] Several different views of the same post type needed

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.

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: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 year, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2656033

I am trying to create and display several different views of the same post type.

I am having trouble finding just the right documentation.

There are two cases I would like to be able to implement. Say, for example, that

1. I have a custom post type "DOG" that contains basic information about each dog. The main page for each dog shows just the basics. I want to be able to display more information about each dog on separate pages "Dog's favorite food" and "Pictures of this dog" or whatever, all linked from the dog's main page. I need to know how to pass the information when the link is clicked on: I only want these linked pages to display that information from the dog who's page I linked from.

2. I have a view that lists very basic information about all "DOGS". Within this view I would like to include links to those supplemental pages mentioned above (so, not just back to the main post url). I need to know how to pass the information when the link is clicked on: I only want these linked pages to display information from the dog in the "loop" who's link I clicked on.

I know this should be simple, but I'm just not getting it right. Thanks in advance!

#2656109

Hi,

Thank you for contacting us and I'd be happy to assist.

You can use the query filter option in views linked to the target dog's Post ID, passed in the URL parameter.
https://toolset.com/course-lesson/filtering-custom-lists-of-posts/#filtering-by-post-id

For example, suppose you have a generic page 'Dog's favorite food' at:

{yourwebsite.com}/dogs-favorite-food/

On this page, you can create a view that shows the information of a dog post, whose ID is passed in the URL parameter, something like 'target-dog'.
( you'll find this post ID filter option under the view's content selection tab )

This way, by just changing the ID of the dog post in the URL parameter 'target-dog', the information of the individual dog will change on that same page:

{yourwebsite.com}/dogs-favorite-food/?target-dog=123
{yourwebsite.com}/dogs-favorite-food/?target-dog=456
{yourwebsite.com}/dogs-favorite-food/?target-dog=789

Note: To pass the current dog post ID in the URL parameter, whether you're in the loop of a view or on the single dog post page, you can use the 'wpv-post-id' shortcode:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-id

{yourwebsite.com}/dogs-favorite-food/?target-dog=[wpv-post-id]

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

#2656143

This is exactly what I needed. Worked right away, thank you so much.