• Resolved cogo

    (@cogo)


    My php skills are mediocre but I’m hoping someone else can help me out here. You know the previous/next links at the index page that lead to older, or newer, entries? I did some modifying and put images instead of the default « and » signs. However to make it look the best I put them as backgrounds in the alignleft and alignright classes. Now the question; is there a way to make an if statements in the index.php so the alignleft and alignright divs only appear in there is content in either the previous or next pages? Right now the images stay when the text links are gone, and it looks a bit unprofessional.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Would this plugin help simplify things? http://guff.szub.net/2005/01/18/next-previous-post-img/

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Not if you want them to remain backgrounds of the divs themselves, no. Instead of doing it that way, why not just change out the text of the previous/next function calls with img tags, so that the images appear there instead of the text? No CSS editing needed.

    Thread Starter cogo

    (@cogo)

    I’m such an idiot! I seem to have solved it myself with some logical thinking. I just put the divs between the php.

    <div class="navigation">
    <?php next_posts_link('<div class="alignleft">Previous Entries</div>') ?>
    <?php previous_posts_link('<div class="alignright">Next Entries</div>') ?>
    </div>

    Maybe this can help someone in the future.

    Thanks for responses though guys, appreciate it! =)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘if statement for previous/next links’ is closed to new replies.