Skip Navigation

[Resolved] Displaying a content template in a widget

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

Last updated by Thorworx 3 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2089825

I've created a very simple content template using the block editor.
It displays a cover image using dynamic content (featured image), and the page title.

I want to display this template in a widget area on the page.

There doesn't seem to be any easy way to do this. There is no Toolset content template widget.
So I created a View that includes only my content template, that I could add using the WP Views widget.
The problem is in the View's filter, I can't filter by the current post in the loop, so ALL posts are returned in the query.

I can output the content template correctly in the page directly, but I need it in a widget area.

Why can't I create a View using blocks and dynamic content?

#2090123

Hi,

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

You don't need a view in this case, since it is possible to display a content template directly using the shortcode "wpv-post-body":
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

Example:


[wpv-post-body view_template="Name of the content template"]

Note: You'll replace "Name of the content template" with your actual template's name.

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

regards,
Waqar

#2090349
Screen Shot 2021-06-16 at 6.20.55 AM.png

Thank you, Waqar.. I will try adding the shortcode to my widget.

I have another problem.. when trying to solve my issue, I decided to recreate my content template.
But I can no longer choose Featured image as the dynamic source. It only shows Author picture URL in the drop-down.
See attached screenshot

#2090495

Update:
After a couple of hours, it eventually let me choose the featured image from the dropdown (I have no idea why it started working - this seems like a bug), and the widget is working.

I will mark this as resolved, but I will reply to this again if I have further trouble.

#2090505

My issue is resolved for now. Thank you!