Skip Navigation

[Resolved] I need to show only the field values of current post of my CPT in my view

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to filter their view by a shortcode parameter that takes a post ID.

Solution:

The first thing that is needed to be done is to add your query filter.

This can be done by clicking the Add Query Filter button, then adding the filter for Post ID.
Then set the filter to get its value from a shortcode parameter.

Following this then you should be able to setup your view like this.

[wpv-view name="MY-VIEW-NAME" ids="[wpv-post-id]"]

Where ids is the parameter you've set it to be and the [wpv-post-id] shortcode is providing the view with an id to filter the posts.

This support ticket is created 5 years, 8 months ago. 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by willemP 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1230074

I have a view and the filter setting:
Posts with ID's set by the View shortcode-attribute: ids

I want the page only showng the values for the current post.

In my page I have the shortcode:
[wpv-view name="MY-VIEW-NAME" ids="[wpv-post-id id='$current_page']"] OUTPUT > "]

When I use this:
[wpv-post-id id='$current_page'] OUTPUT > ids="1122"

When I use this:
[wpv-view name="MY-VIEW-NAME" ids="wpv-post-id"] OUTPUT > No items found

#1230122

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Willem,

Thank you for contacting our support forum.

Actually by default the [wpv-post-id] shortcode will display the ID of the current post.

So what you need to do is just this.
[wpv-view name="MY-VIEW-NAME" ids="[wpv-post-id]"]

Please let me know if this helps.
Thanks,
Shane

#1230161

It gives me all the records.

[wpv-view name="MY-VIEW-NAME" ids="[wpv-post-id]"] OUTPUT > All Posts

#1230164

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Willem,

That is odd.

Would you mind allowing me to have access to the site so that I can quickly check on this for you ?

Thanks,
Shane

#1230218

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Willem,

The issue seems to be with the Shortcode editor for elementor.

I've added the shortcode to a regular text block for elementor and it works fine.

Thanks,
Shane

#1230357

Thanks for helping me out. I will drop a ticket at Elementor.