WordPress.org

Support

Support » How-To and Troubleshooting » How?: Add an image at the end of each post

How?: Add an image at the end of each post

  • I used to have a blogger account and it was easy to change the ONE template… so I don;t know where to look for what I want to do.

    I want to add a single, small image <img src="images/black.gif" width="4" height="4"> that will appear about two ems after the very last word or punctuation mark of each blog entry, on the same line, without having to enter an image tag in my actual posting every time. I just want it to “be there” when I view my site.

    Where would I enter such code so that it is included as I have described?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Probably in the index.php template – just after the_content tag. Give it a class and style it in the CSS file.

    I tried this technique and all it did was hang my site. I don’t know PHP. My example:

    <p class="centeredImage"><img src="http://zzz.com/images/badge.png" border="0" height="15" width="80"></p>

    That call works elsewhere in the site, but I suspect there’s some PHP code that has to go around this. What?

    From the index.php from the theme I’m using:


    // single page
    // -----------
    if( !is_single() ) {

    if ( $usePassword ) { echo "<div class=\"passwordPost\">"; }

    if ( $pageDisplay == 0 ) {
    the_content();
    } else {
    the_excerpt();
    }

    if ( $usePassword ) { echo "</div>"; }

    } else {

    if ( $usePassword ) { echo "<div class=\"passwordPost\">"; }

    the_content();

    if ( $usePassword ) { echo "</div>"; }
    }

    wp_link_pages();

    echo "<!--";
    trackback_rdf();
    echo "-->";

    if( is_single() ) {

    comments_template();

    }

    endwhile; else: ?>

    Clueless…

    Thanks in advance!

    Strange code you have there… which theme?
    And where did you put your “example”?
    Link?
    (please, don’t post your whole index here – if you need to post long code, use a pastebin service, like http://paste.uni.cc)

    There is a plugin to do exactly this. Unfortunately, the site seems to be down at the moment. Maybe you can check again in a while?

    There is another plugin, too:
    http://guff.szub.net/2006/02/09/post-image/

    Moshu,

    The theme is a fairly popular one, Regulus 2.1.

    Didn’t matter which “the_content()” I put it in after. I got a blank screen when I tried to reload the site.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How?: Add an image at the end of each post’ is closed to new replies.