Infographic Shortcode displaying amp html code.
-
This is the problem I am facing. Please help
****************page ****************
[ redundant link removed ]
****************Shortcode Function for Embeded Code for infographics****************
add_shortcode('embedimage', 'cynoteck_embed_image'); function cynoteck_embed_image($atts, $content = null) { global $post; $link_init = (isset($atts['nolink'])) ? '' : '<a href="'.get_permalink($post->ID).'" target="_blank">'; $link_end = (isset($atts['nolink'])) ? '' : '</a>'; $html = <<<HTML <textarea id="textarea">{$link_init}<img src="{$atts['img']}" alt="{$atts['title']}" border="0" />{$link_end}</textarea> HTML; return $html; }
****************Shortcode in the content****************
[embedimage img="https://localhost/cynoteck/wp-content/uploads/2019/12/muzammil-soorma-611403-unsplash-940x470.jpg" title="muzammil-soorma"]
****************Output Result****************
<a href="https://cynoteck.com/demo/blog-post/pwa-vs-native-app-comparing-cost-and-long-term-usability/" target="_blank"><amp-img src="https://cynoteck.com/demo/wp-content/uploads/2019/11/PWAvsMobile_infographic.jpg" alt="" width="423" height="496" class="amp-wp-enforced-sizes" layout="intrinsic"><noscript><img src="https://cynoteck.com/demo/wp-content/uploads/2019/11/PWAvsMobile_infographic.jpg" alt="" border="0" width="423" height="496" class=""></noscript></amp-img></a>
****************Output Result We need****************
<a href="https://cynoteck.com/demo/blog-post/pwa-vs-native-app-comparing-cost-and-long-term-usability/" target="_blank"><img src="https://cynoteck.com/demo/wp-content/uploads/2019/11/PWAvsMobile_infographic.jpg" alt="" ><img></a>
- This topic was modified 4 years, 11 months ago by .
- This topic was modified 4 years, 11 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘Infographic Shortcode displaying amp html code.’ is closed to new replies.