-
AuthorPosts
-
May 22, 2024 at 7:13 pm #14700three estateParticipant
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.pngBut 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
RaulMay 23, 2024 at 12:03 am #14705Aakash ChakravarthyKeymasterHi 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="detalhes_excerpt"][/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,
AakashMay 23, 2024 at 2:59 am #14709three estateParticipantHi 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
RaulMay 23, 2024 at 3:12 am #14710three estateParticipantin time:
This is the code:
https://threeestate.com.br/uploads/detalhes_excerpt.pngThanks again
RaulMay 23, 2024 at 10:25 pm #14713three estateParticipantHi 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); }
May 23, 2024 at 11:40 pm #14714Aakash ChakravarthyKeymasterHi Raul,
Exactly, I was planning to suggest that. Glad that you figured it out.
Thanks,
Aakash -
AuthorPosts
- You must be logged in to reply to this topic.