• 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 Jan Dembowski.
    • This topic was modified 4 years, 11 months ago by Jan Dembowski.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • @alenny852 thanks for the topic. I currently see this output on the front-end:

    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

    (@alenny852)

    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

    @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.