WordPress.org

Ready to get started?Download WordPress

Forums

How to add an icon/graphic to the end of each post content (3 posts)

  1. benfrain
    Member
    Posted 4 years ago #

    I'd like to add a little icon/graphic at the end of the text of every post.

    I can add a icon/graphic below each post by amending single.php like so:

    <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/bf.gif" />

    However, I want the graphic to be inline with the text within the post, not outside. For example, at present it looks like this:

    ...end of the post.
    <graphic here>

    And I want it to be like this:

    ...end of the post. <graphic here>

    Anyone know what I need to do to solve this?

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    this might work if used instead of your code:

    <?php $text = get_the_content().' <img src="'.get_bloginfo('template_directory').'/images/bg.gif" />';
    echo apply_filters('the_content',$text); ?>
  3. benfrain
    Member
    Posted 4 years ago #

    You're beautiful. Anyone ever tell you that? ;) Worked a charm. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic