Skip Navigation

[Resolved] [wpv-view name="shortcode-slug" wid="[wpv-post-id]"] not working

This support ticket is created 6 years 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Minesh 6 years ago.

Assisted by: Minesh.

Author
Posts
#1168957

I am trying to get a shortcode to display only the information about the post it is embedded on.

I am using `[wpv-view name="event-header" wid="[wpv-post-id]"]` for this but all I am getting is: `"]`

How can I filter by post_id = id of the page where the view is being displayed

#1168997

Ok so I did the following:

Created a custom post type.
Created a view that shows information specific to that post type, say the title (example only, the actual view uses lots of conditional tags).
I wanted to display the content using shortcodes in my theme so I created a page with the following php code to show the view for the current page only (limited view to show 1 page filter by id set by shortcode attribute).
`<?php
$wid = get_the_ID();
echo $wid;
?>

<?php echo do_shortcode('[wpv-view name="event-header" wid=". $wid ."]'); ?>`

It displays no posts found. So I got pissed and pasted the loop content into the "not found" area, and it actually works as intended. It shows the content for the particular post type I am editing.

But that makes no sense 😐

#1169386

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I would like to know here that have you added the view to your theme's PHP template file?