Skip Navigation

[Resolved] Excerpt View Not Working

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

Problem: I want to display the excerpt of the current post in a View on the current post.

Solution: The View may not be necessary if it's only purpose is to show the excerpt of the current post. In that case, you can simply use the wpv-post-excerpt shortcode. However, if the View is also showing other posts, then you can use item="$current_page" in the post excerpt shortcode to target the current post.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/

This support ticket is created 4 years, 9 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.

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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by davidM-44 4 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1296899

I want to create a view within a post page that displays only the excerpt for the current post. The problem is, when I insert the short code into post-2, after having created post-1, then when I go back to post-1, I see the excerpt for post-2!!

Clearly, I need some kind of filter in my view that says to display only the excerpt for the current post, but I cannot figure out how to do that. I've tried a variety of filter options, but I cannot seem to find one that works.

Obviously, my view has to be based on posts rather than taxonomy or users, so that is the option I'm using. I DO want to include the current page in the search results, but it appears that your code creates a secondary search for the excerpt, so it's ALWAYS going to find the excerpt for the LATEST post, even if I want to display the excerpt for some other post that was published before this latest post!

How do I solve this problem?

David McLeod

#1297019

Hi, if the purpose of the View is to only show the excerpt of the post being currently displayed, then a View is not necessary. You can use the excerpt shortcode to display the current post's excerpt:

[wpv-post-excerpt]

More information about this shortcode is available here https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-excerpt

However, if the View is used to display information about another post, as well as the current post's excerpt, then you can use the "$current_page" operator to display information about the current post, from inside that View:

Excerpt of the post shown in this View: [wpv-post-excerpt]<br />
Excerpt of the post where this View is shown: [wpv-post-excerpt item="$current_page"]

If you're trying to learn more about filtering a View based on the current post or page, then you can read more about passing arguments to Views here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/
You could set up a post ID filter and pass in the current posts's ID in a shortcode attribute.

#1297173

My issue is resolved now. Thank you!

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