Title: Infographic Shortcode displaying amp html code.
Last modified: December 26, 2019

---

# Infographic Shortcode displaying amp html code.

 *  [alenny852](https://wordpress.org/support/users/alenny852/)
 * (@alenny852)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/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="http://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 6 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
    -  This topic was modified 6 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finfographic-shortcode-displaying-amp-html-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Renee Johnson](https://wordpress.org/support/users/reneesoffice/)
 * (@reneesoffice)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/infographic-shortcode-displaying-amp-html-code/#post-12274156)
 * [@alenny852](https://wordpress.org/support/users/alenny852/) thanks for the topic.
   I currently see this output on the front-end:
 * [https://jmp.sh/KlGG9yy](https://jmp.sh/KlGG9yy)
 * With that said, I also see there is a validation error on the pages of the site
   due to the `amp-script` extension being enqueued, but the `amp-script` is not
   being used. So the page itself is not being served as AMP valid. Feel free to
   provide an update on your progress.
 *  Thread Starter [alenny852](https://wordpress.org/support/users/alenny852/)
 * (@alenny852)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/infographic-shortcode-displaying-amp-html-code/#post-12288447)
 * Thanks Renee for replying
 * I used the exc_html function to prevent it from generating the amp code.
    I check
   the page from Validator, What can be the cause for this? I though I have a valid
   AMP page
 *  [Renee Johnson](https://wordpress.org/support/users/reneesoffice/)
 * (@reneesoffice)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/infographic-shortcode-displaying-amp-html-code/#post-12297845)
 * [@alenny852](https://wordpress.org/support/users/alenny852/) thanks for following
   up. When I check the site now I see that the `amp-script` extension has been 
   removed and your pages are now valid AMP.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Infographic Shortcode displaying amp html code.’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [wordpress amp](https://wordpress.org/support/topic-tag/wordpress-amp/)

 * 3 replies
 * 2 participants
 * Last reply from: [Renee Johnson](https://wordpress.org/support/users/reneesoffice/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/infographic-shortcode-displaying-amp-html-code/#post-12297845)
 * Status: not resolved