Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author jhanbackjr

    (@jhanbackjr)

    Hello, ashish-verma.

    I’m not sure if this is what you’re asking for, but you could make use of the WordPress do_shortcode function inside a theme file to obtain the iframe.

    For example, if you wanted to display the iframe that contains reviews for Stephen King’s 11/22/63, you could include the following PHP code at an appropriate place in single.php:

    <?php echo do_shortcode('[scrapeazon asin="1451627297"]'); ?>

    Let me know if that’s not what you were looking for.

    Thanks for using ScrapeAZon.

    James

    Thread Starter Ashish Verma

    (@ashish-verma)

    Thanks, it’s working as desired. One more thing, how I can add more iframe parameters like scroll off, height / width, etc?

    Plugin Author jhanbackjr

    (@jhanbackjr)

    Hello, ashish-verma.

    You can control the width and height of the iframe by issuing the width and height parameters in the shortcode. For example:

    <?php echo do_shortcode('[scrapeazon asin="1451627297" width="500" height="500"]'); ?>

    You can disable the iframe border by using the border="false" shortcode parameter.

    However, if you prefer not to add the shortcode parameters, you can also style the iframe by using CSS. The iframe element’s ID is scrapeazon-iframe. Therefore, you could add the following CSS to your theme/child theme to style the iframe:

    #scrapeazon-iframe {
       height: 500px;
       width: 500px;
       border: none;
    }

    Currently, ScrapeAZon does not support including the full range of iframe options in the tag itself by way of the shortcode. (For example, you can’t set scrollbars="no" in the iframe tag by way of the shortcode yet). However, support for parameters other than height, width, and border might be added in a future version.

    Thanks for using ScrapeAZon. Since you have the shortcode working in PHP, I’m marking this topic as resolved. Let me know if I can be of further assistance.

    James

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php code to show in theme files’ is closed to new replies.