Forums

[resolved] Editing ads in PHP (6 posts)

  1. ChocolateArchy
    Member
    Posted 2 years ago #

    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.

  2. ClaytonJames
    Member
    Posted 2 years ago #

    I think the new 125x125 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="http://your_link_to_amazon_here.com" ><img src="<?php bloginfo('stylesheet_directory'); ?>/images/your_new_add_image.jpg" alt="ads" /></a>

    I think.

  3. ChocolateArchy
    Member
    Posted 2 years ago #

    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?

  4. kennethwatt
    Member
    Posted 2 years ago #

    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" />

  5. Pankaj Pandey
    Member
    Posted 2 years ago #

    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

  6. Mark / t31os
    Moderator
    Posted 2 years ago #

    Use get_bloginfo() ...

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

Topic Closed

This topic has been closed to new replies.

About this Topic