1

I'm pretty new to Wordpress and I'm a bit stuck.

I have created a site and I'm linking to Amazon. I read their ToS and I'm not allowed to hardcode the price in because of price fluctuations. I signed up to the API and got my key and have programmed a function to query the API for the price of an item using the ASIN. This works fine, but when I try to use it in a post it doesn't work.

I downloaded the "Insert PHP" plugin so I can use shortcode to call my function and echo out the price.

This works partially, but when I echo the returned string it's wrapped in <p> tags so I cannot echo it out in a <h2> tag properly.

How can I get this to work? Is there a way I can echo it out without being wrapped in the <p> tags?

Thanks

  • 1
    please post your code. – Michael Dec 18 '16 at 0:50
  • <?php echo "item price"; ?> Is all I was using essentially but the "Insert PHP" plugin seems to wrap it in <p> tags, but I found out after a bit of research, the way I should do it, is create a shortcode of my own for my function. – Rikki B Dec 18 '16 at 18:11
2

It was a stupid question, I just realized, if I just create a custom shortcode for it, the plugin will not wrap it in <p> tags then, or even better still just create it as a plugin of it's own.

0

Have you considered using a plugin for the whole integration? Not sure if you're doing something more customized than affiliate products though.

Not the answer you're looking for? Browse other questions tagged or ask your own question.