Skip Navigation

[Resolved] Shortcode view not rendering as it should

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

Last updated by jelle-jacobd 3 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#2128113

Hi,

I'm trying to use the shortcode below on a page. I'm using WP Bakery. But it's not rendering correctly. If I enter a id manually replacing the custom field string, the code renders. What am i doing wrong?

[wpv-view name="Project Related Products" ids="[wpv-post-field name='project-related-products']"]

Thanks!

Br, Jelle

#2128135

Shane
Supporter

Languages: English (English )

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

Hi Jelle,

Thank you for getting in touch.

What I would do in this case is to double check to see what the view is getting in the ids parameter using the shortcode below.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-attribute

This should be able to tell you what is being passed to the view and one step in finding out where to start looking for the issue.

Thanks,
Shane

#2128653

Hi Shane,

Thanks for getting back at me!

I'm not sure if I understand exactly what you mean. If I use the same shortcode in a Toolset content template and place it on the page in a text field in WP Bakery, the shortcode works without any problems.

1) This doesn't work > and shows a " on the page.

[wpv-view name="Project Related Products" ids="[wpv-post-field name='project_related_products']" cached="off"]

If I put this same shortcode in a Toolset content template and include it in my page like this:

[wpv-post-body view_template='project-related-posts' suppress_filters='true']

It works.

2)The only problem left then is the fact that the view shows all possible products if no value is available for [wpv-post-field name='project_related_products']

How can I solve this the best way? Should it work directly without the need of a Toolset content template (1)? And how do solve the all results issue (2)?

Thanks, Jelle

#2128961

Shane
Supporter

Languages: English (English )

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

Hi Jelle,

What the [wpv-attribute] shortcode allows you to do is to check if the value being passed into the view is coming in correctly.

Essentially if you add the [wpv-attribute] shortcode inside your view you should be able to tell what value is being passed into the view. If no value is being passed then it gives you some direction in where to look to solve the issue.

So what I would do is add [wpv-attribute name='ids'] inside your view then check your view on the frontend to see if the value of the [wpv-post-field name='project_related_products'] shortcode is being printed out by the [wpv-attribute name='ids'] inside the view.

Thanks,
Shane

#2129085

Hi Shane,

Thanks, that works. De view prints an id, 9134 in my case. So it seems it works. Id is corresponding to the correct product. So I guess it's the page or WP Bakery I'm using which is capable of working with the shortcode? It seems like it cuts it off somehow. Like I mentioned, when using a Toolset content template as a "workaround", it works.

Br, Jelle

#2129101

Shane
Supporter

Languages: English (English )

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

Hi Jelle,

Would you mind allowing me to have admin access to the site so that I can have a first hand look ?

I've enabled the private fields for your next response.

Please also send me a link to the page where you have this view being also displayed.

Thanks,
Shane

#2129219

Shane
Supporter

Languages: English (English )

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

Hi Jelle,

It could be a case where the WPBakery Builder isn't able to manage the nested shortcodes.

If this workaround works then I don't see any issues with using it.

Thanks,
Shane

#2129507

Hi Shane,

You're right. If it works, it works. But it's good to know why. Also good to know we came to the same conclusion and it wasn't a mistake on my part.

Br, Jelle