Navigation überspringen

[Gelöst] Follow up: trouble with using [wpv-conditional] shortcode

This support ticket is created vor 7 Monaten, 3 Wochen. 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 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 3 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von Minesh vor 7 Monaten, 3 Wochen.

Assistiert von: Minesh.

Author
Artikel
#2780454
Screenshot 2024-11-01 at 09-57-40 Pepper Ranch Preserve – Florida Hikes.png

Per the excellent explanation by Mateus on the now-locked thread "Upgrade from Version 2.3.5 with newly purchased Toolset," I'm having no trouble using the shortcodes to display the contents of Types fields on the front end of my WordPress installation with a Genesis theme.

However, when I attempt to use the [wpv-conditional if="( NOT(empty($(wpcf-trail-land))) )"][types field="trail-length"][/types] miles[/wpv-conditional] statement, it simply echoes that text into the page. See image.

Is there any documentation that you are following? https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpml-conditional

What is the link to your site? It's a staging site behind a firewall so I have no easy way to share it.

#2780514

Mateus Getulio
Unterstützer

Sprachen: Englisch (English )

Zeitzone: America/Sao_Paulo (GMT-03:00)

Hello Sandra,

Are you adding the shortcode via PHP?

Using the function do_shortcode might help it to be properly rendered instead of plain text, .eg:

echo do_shortcode('[wpv-conditional if="( NOT(empty($(wpcf-trail-land))) )"][types field="trail-length"][/types] miles[/wpv-conditional]');

Thank you, please let us know how it goes.
Mateus

#2780518
wpv-conditional.png

No, I'm adding it as a shortcode into the body text exactly like this:

[wpv-conditional if="( NOT(empty($(wpcf-trail-length))) )"]
[types field="trail-land"][/types]   [types field="trail-loc"][/types]   ([types field="trail-lat-lon"][/types])   [types field="trail-length"][/types] miles
[/wpv-conditional]

The [wpv-conditional] appears on the screen and its logic does not work.

My intent was to add it into the header meta via Genesis Simple Hooks which will output the types field shortcodes just fine, but does the same thing of exposing the [wpv-conditional] logic as plain text instead of running it.

#2781491

Minesh
Unterstützer

Sprachen: Englisch (English )

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

Hello. Thank you for contacting the Toolset support.

What if you try to crate a content template from: Toolset => Content Templates and then try to add shortcodes block to this content template and add your desired conditional statement to this shortcodes block and save the content template and later add this content template to header meta via Genesis Simple Hooks and check if that works.

To display the content template, you will have to use the shortcode:

[wpv-post-body view_template="content-template-slug"]

Where:
Replace "content-template-slug" with your original content template slug.

More info:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body