![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: shortcode, shortcode in title, Shortcodes, title
-
AuthorPosts
-
November 14, 2019 at 2:50 pm #1156804
Hi, I am using shortcodes in titles, enabled with
add_filter( 'the_title', 'do_shortcode' );
When I look at the source code of a page though, it looks like Enfold is not parsing the shortcodes.
You can see this here: https://pumpupboats.com/fishing-inflatable-boats/
This is a source code fragment:<script type="application/ld+json">[{"@context":"https:\/\/schema.org","@type":"Article","headline":"Best fishing inflatable boats [New in [year]]",
The same happens in the recommended posts at the bottom of the page.
How can this be fixed?
Thanks
Tom-
This topic was modified 4 years, 9 months ago by
fisherman.
November 15, 2019 at 8:58 pm #1157293Hey Tom,
Best regards,
VictoriaNovember 16, 2019 at 9:34 pm #1157536Hi, the title tag is the only place it is parsed.
Please do a search for [year] in the source code and you’ll see all the places the shortcode is not converted.
Best
TomNovember 17, 2019 at 2:42 am #1157571Hi,
I only found 4 instances of [year] on your page, once in “schema”, once in “structured-data” and twice in an image “alt”
I don’t believe that shortcodes can be parsed in these places.Best regards,
MikeNovember 18, 2019 at 5:18 pm #1157922Hi, the schema tags are generated by Enfold, or are they not?
I found another Enfold generated spot where the shortcodes are not converted, in the Related posts section at the end of a post.
Here is an example, you might have to refresh a few times to get a related post that has the [year] shortcode:Best,
Tom
ps: The img alt tags with the shortcode are my fault, don’t mind those.November 19, 2019 at 12:09 pm #1158112Hi,
I don’t believe that shortcodes can be parsed in the schema tags.Best regards,
MikeNovember 19, 2019 at 3:10 pm #1158177So is this a limitation of Enfold?
November 20, 2019 at 12:18 pm #1158440Hi,
I don’t believe this is a “limitation” your filter adds “do_shortcode” for titles not schema.
Please post your shortcode code and where you are adding it so we can test.Best regards,
MikeNovember 20, 2019 at 4:41 pm #1158537Please answer this:
Does Enfold generate the schema markup I referenced?November 21, 2019 at 12:51 pm #1158802Hi,
From what I see it is in our PHP files, but “do_shortcode” is not applied.Best regards,
MikeNovember 21, 2019 at 3:33 pm #1158835Yes, this is the reason for this error.
Can you fix this in the next release?
Thanks
TomNovember 22, 2019 at 1:32 pm #1159131November 22, 2019 at 1:39 pm #1159134Thank you!
TomDecember 22, 2019 at 3:04 pm #1168571Hi,
Good news, the dev team has adjusted the theme’s core files for parsing the shortcode in the schema and it is included in the next version. It is based on this shortcode.
So now it works in our schema:
But the source code fragment you posted in the opening post is the schema created by the “rank math” plugin, and it seems to have it’s own logic and is not using the theme’s schema data and is not parsing the shortcode.
While we can not support 3rd party plugins, perhaps the “rank math” plugin has a filter to allow shortcode parsing now that the theme is?Best regards,
Mike -
This topic was modified 4 years, 9 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.