Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • three estate
    Participant

    Hi there.
    Shortcoder is an excelent plugin, an help me a lot.

    In this case im using the shortcoder to create post excerpts, using data on ACF fileds.
    Inside the website everything is working fine as you can see on the image https://threeestate.com.br/uploads/6213.png

    But when i paste the post link inside the whatsapp, the content of shortcode is not rendered, as you can see here https://threeestate.com.br/uploads/whatsapp.png

    Can you please help me with this issue?

    Thanks in advance
    Raul

    Hi Raul,

    Thanks for using Shortcoder.

    Social media sites, pull that text from HTML “metadata”.

    When you view the page source, you can see the tag below.

    view-source:https://threeestate.com.br/imoveis/residencia-6213/

    <meta name="twitter:description" content="[sc name=&quot;detalhes_excerpt&quot;][/sc]" />

    This is added by yoast SEO and yoast SEO is NOT executing shortcodes. This is not only for shortcoder, any shortcode you insert in post excerpts it won’t work.

    Solution is to check with Yoast SEO team and see if they can execute shortcodes in “opengraph” meta twitter descriptions or try pasting the code below in functions.php file of your theme.

    https://stackoverflow.com/questions/73485852/wordpress-shortcode-not-rendering-in-yoast-ogtitle

    add_filter( 'wpseo_opengraph_desc', 'do_shortcode' );
    add_filter( 'wpseo_twitter_description', 'do_shortcode' );

    Hope this helps.
    Let me know how it goes.

    Thanks,
    Aakash

    three estate
    Participant

    Hi Aakash.

    It Works! Or almost, please see the image: https://threeestate.com.br/uploads/7957.png

    Although the shortcode is being displayed, the html tags that I used in the construction are also appearing.

    Do you have any tips for this issue too?

    Thanks in advance
    Raul

    three estate
    Participant

    in time:
    This is the code:
    https://threeestate.com.br/uploads/detalhes_excerpt.png

    Thanks again
    Raul

    three estate
    Participant

    Hi again.
    I manage to solve the problem adding the folowing code:

    add_filter('wpseo_twitter_description', 'strip_excerpt_html');
    
    function strip_excerpt_html($excerpt) {
        return wp_strip_all_tags($excerpt);
    }

    Hi Raul,

    Exactly, I was planning to suggest that. Glad that you figured it out.

    Thanks,
    Aakash

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

Subscribe to our Newsletter

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter

By using this website, you agree to our Terms