Skip Navigation

[Resolved] Hi, how can I filter a view to show only content from the current post?

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

Problem:

Filter a view to display items of the current page where it has been added.

Solution:

I've outlined the solution as well some screenshots in the link below.

https://toolset.com/forums/topic/hi-how-can-i-filter-a-view-to-show-only-content-from-the-current-post/#post-1084700

This support ticket is created 6 years, 4 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 14 replies, has 2 voices.

Last updated by valterB 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1083921

I want to create a view, for use in a content template, that shows date, author etc from the current post only. I did not understand how to do this with the filter query.

#1083966

Shane
Supporter

Languages: English (English )

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

Hi Valter,

Thank you for contacting our support forum.

What you need to do is to add a query filter for the post ID and then tell it to get the Post ID from the page where this view was added.

Please let me know if this helps.

Thanks,
Shane

#1084429

Hi Shane, thanks for quick response.
I added query filters in a few different ways in the new view, but unfortunately did not succeed. The result on the front end: "No items found".
Could you give me a more detailed description?
/Valter

#1084641

Shane
Supporter

Languages: English (English )

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

Hi Valter,

If it returns no results found then I would need to have a look at how it is setup.

Could you provide me with some screenshots of the query filter as well as a screenshot of where this view is added ?

Thanks,
SHane

#1084651
Skärmavbild 2018-08-16 kl. 16.30.51.png

I have tried to use the filters for "post ID" and "post relationsship", with no luck so far.
Enclosed is a screen dump of one of my attemtps.

#1084659

Shane
Supporter

Languages: English (English )

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

Hi Valter,

Whats needed is the post ID one.

Would you mind allowing me to have access to the site to look at this further for you ?

Also let me know the post that this view should be added to.

Thanks,
Shane

#1084682
Skärmavbild 2018-08-16 kl. 17.01.54.png

Actually I never understood how to correctly do the settings for "Post ID", so that is what I need to learn.
Could you tell me how to fill in the query form for Post ID?
(If necessary, of course, I could give you access)

#1084699

I have set up an admin account for you, let me know if you need it.

#1084700

Shane
Supporter

Languages: English (English )

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

Screen Shot 2018-08-16 at 10.21.27 AM.png
Screen Shot 2018-08-16 at 10.21.39 AM.png
Screen Shot 2018-08-16 at 10.22.55 AM.png

Hi Valter,

Take a look at the screenshots i've provided.

Please let me know if these were able to guide you through the setup.

Thanks,
Shane

#1084723
Skärmavbild 2018-08-16 kl. 17.41.04.png

It seems I need help with the next step also, to make this work.

I use the view in a Content Template for posts. When adding the view in the content template there are settings that I may not have filled in correctly.

Encloses is a screen dump with this settings form.
I have tried different settings, none succeeded in showing content from current post

#1084729
Skärmavbild 2018-08-16 kl. 17.46.32.png

Now I discovered more tabs on the form when adding av view in the content template

Is this where I add info to show current post? If so, how? (Screenshot)

#1084768

Shane
Supporter

Languages: English (English )

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

Hi Valter,

You don't need to edit any of the settings in the screenshot.

All you need to do is to insert the shortcode into the content template.

Thanks,
Shane

#1084781

When I insert the view's shortcode in the content template it shows content from lots of posts. If i set the limit=1 content from the most recent post is shown. Not from the current post.

#1084782

Shane
Supporter

Languages: English (English )

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

Hi Valter,

Take a look at the screenshots here https://toolset.com/forums/topic/hi-how-can-i-filter-a-view-to-show-only-content-from-the-current-post/#post-1084700

Notice that I added a shortcode parameter called ids='[wpv-post-id]' this is what allows the filtering to work.

Thanks,
Shane

#1084783

Ooops - I hade totally missed that screenshot (only looked at the two other screen shots). I put this in the content template and it seems to work perfectly. Thanks for your patient support.