• Resolved chocolatearchy

    (@chocolatearchy)


    I am attempting to add Amazon.com affiliate links to the three ad spaces that are on the WordPress theme I am using (Brownline). Amazon’s links are in HTML. The only way I have found to edit the three ad spaces is through the Appearance Editor and “ads.php.” “ads.php” looks like this:

    <div id=”sad”>

      <li class=”sad_margin”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/ads.jpg” alt=”ads” />
      <li class=”sad_margin”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/ads.jpg” alt=”ads” />

    • <img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/ads.jpg” alt=”ads” />

    </div>

    My question is this: how do I insert the HTML in the above code so the Amazon ads appear on my homepage? I have been able to get a little question mark in a box, but the ad will not show up.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I think the new 125×125 ad image gets uploaded to the directory where the current blank image is located. You then make the image “clickable” by adding the link to amazon. <a href=""> <img src="" /></a> and change the image reference to reflect your new ad image.

    <li class="sad_margin"><a href="https://your_link_to_amazon_here.com" ><img src="<?php bloginfo('stylesheet_directory'); ?>/images/your_new_add_image.jpg" alt="ads" /></a>

    I think.

    Thread Starter chocolatearchy

    (@chocolatearchy)

    Thanks, but something is still wonky. The link works perfectly, but I’m still getting a question mark instead of an image. I loaded my image to the media library and tried to link to the image from there. Should I have done something else? I have also tried to link to the image directly from Amazon, as that is provided in the product HTML, but that also produced only a question mark.

    Also, I am working on just one of the three ads provided, trying to figure this out. While trying the link hidden beneath the question mark, I noticed that the other two ads, which I have not yet edited, also link to the product I am trying to advertise. How do I end the script from one ad to another?

    It shouldn’t have the stylesheet directory. Navigate to /wp-content/uploads and then choose the image.
    Replace
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/ads.jpg" alt="ads" /> with `<img src=”The exact URL of the image that you want display” alt=”ads” />

    Replace <?php bloginfo(‘stylesheet_directory’); ?> with
    <?php bloginfo(‘template_url’); ?>

    <?php bloginfo(‘stylesheet_directory’); ?> is depricate
    or you can follow @kennethwatt

    let me know its working.

    Pankaj

    Use get_bloginfo() …

    bloginfo returns/echoes automatically, so you need to use get_bloginfo for things such as image paths..

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Editing ads in PHP’ is closed to new replies.