Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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 5 years ago by fisherman.
    #1157293

    Hey Tom,

    Best regards,
    Victoria

    #1157536

    Hi, 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
    Tom

    #1157571

    Hi,
    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,
    Mike

    #1157922

    Hi, 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.

    #1158112

    Hi,
    I don’t believe that shortcodes can be parsed in the schema tags.

    Best regards,
    Mike

    #1158177

    So is this a limitation of Enfold?

    #1158440

    Hi,
    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,
    Mike

    #1158537

    Please answer this:
    Does Enfold generate the schema markup I referenced?

    #1158802

    Hi,
    From what I see it is in our PHP files, but “do_shortcode” is not applied.

    Best regards,
    Mike

    #1158835

    Yes, this is the reason for this error.
    Can you fix this in the next release?
    Thanks
    Tom

    #1159131

    Hi,
    I added this to our feature request for the dev team.

    Best regards,
    Mike

    #1159134

    Thank you!
    Tom

    #1168571

    Hi,
    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:
    2019-12-22-075702
    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

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.