Forums

My more link image code needs cleaning up. (11 posts)

  1. geezerd
    Member
    Posted 3 years ago #

    I'm using an image instead of text for my more link.
    I went here and tried what they said, which didn't work:
    <?php the_content('Read more...<img src="' . bloginfo('template_directory'). '/images/leaf.gif" alt="read more" title="Read more..." />'); ?>

    This works, but needs the full path from the root:
    <?php the_content(__('<p class="more-line"><img src="/natestest/wp-content/themes/journalist/images/morelink.png" alt="read more" title="Read the rest of this article..." /></p>')); ?>

    Apparently, template_directory is depreciated?

    What do I use to point to the themes images folder?

    Thanks

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    template_directory is not deprecated. Try:

    <?php the_content(__('<p class="more-line"><img src="' . bloginfo('template_directory') . '/images/morelink.png" alt="read more" title="Read the rest of this article..." /></p>')); ?>

  3. geezerd
    Member
    Posted 3 years ago #

    Nope, still doesn't show the image.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Are you sure that you've uploaded the image to the correct folder?

  5. geezerd
    Member
    Posted 3 years ago #

    positive

  6. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    page url?

  7. geezerd
    Member
    Posted 3 years ago #

  8. geezerd
    Member
    Posted 3 years ago #

    Anyone know what I should use here?
    Thanks

  9. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Could you try dropping in the code I gave above? I'd like to be able to see what happens. Is this a child theme by any chance?

  10. geezerd
    Member
    Posted 3 years ago #

    I gave up on it, and just made the image a background. It was nesting a paragraph inside another paragraph the way I had it, anyway.

    CSS: .more-link {display:block; float:right; width:79px; height:32px; background: url(images/morelink.png) center center no-repeat;}

    HTML: `<?php the_content(' '); ?>
    <div class="group">   </div>` ("group is coded for clear:both using group:after. And if I didn't put the   in there, it didn't show up in the source code for some reason...? Dunno why.)

    And then I made the link block taller than the background image and centered the image so it would never smoosh against anything else.

    http://www.seanborggoesla.com/author/sean/page/6/ is the site.

  11. geezerd
    Member
    Posted 3 years ago #

    &nbsp; is what I had to put inside <div class="group"> </div>
    Should read: <div class="group"> &nbsp; </div>
    Strange that did not work at all without the &nbsp; in there, anyone know why?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.