Skip Navigation

[Resolved] Shortcode Not Working Inside Quotes

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

Problem:

The HTML codes and Views shortcodes are being changed to something else, see details here:

https://toolset.com/forums/topic/shortcode-not-working-inside-quotes/#post-1193502

Solution:

It seems Views shortcode [wpv-post-date] does not work as attribute of HTML div tag in the user's website, as a workaround, you can use content template to display the HTML codes + shortcodes, see details here:

https://toolset.com/forums/topic/shortcode-not-working-inside-quotes/#post-1193531

Relevant Documentation:

This support ticket is created 5 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 – 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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by chrisB-30 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1193502

Hi,

Iam trying to add Last Modified Schema to my Taxonomy pages.

I found this shortcode which pulls last modified dates:
[wpv-post-date type="modified"]

And then I put it inside an itemprop:

<div itemprop=”dateModified” content=”[wpv-post-date type="modified"]″>[wpv-post-date type="modified"]</div>

As you can see in the screenshot below it does display the date from the second instance of the shortcode - but the shortcode inside the quotes does not work.

hidden link

Is there some special way I need to set this up inside quotes?

Also, where is that last modified information being pulled from, there is no date associated with a Taxonomy archive so what date is it using?

#1193517

Hello,

The double quotes " in your codes is malformed to: ”,

And I suggest you try to wrap the shortcode within single quotes, for example:

<div itemprop="dateModified" content='[wpv-post-date type="modified"]'>[wpv-post-date type="modified"]</div>

And test again.

#1193525

Unfortunately that did not work:
hidden link

It looks like the quotes are being converted back to double in the html.

Any other ideas?

Also - I am using an Elementor template to display this - not sure if that makes any difference:
hidden link

#1193531
wpv-post-date.JPG

It seems Views shortcode [wpv-post-date] does not work as attribute of HTML div tag in your website, as a workaround, you can create a content template with the same codes as I mentioned above, see below test site:
hidden link
user/pass: xgren/111111

<div itemprop="dateModified" content='[wpv-post-date type="modified"]'>[wpv-post-date type="modified"]</div>

Content template will be able to keep the codes without malformed.

Then put above content template into post content, for example:

[wpv-post-body view_template="YOUR-CT-SLUG"]

See the result in front-end:
hidden link

Screenshot:
hidden link

#1193551

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.