Support » Themes and Templates » Function to check, if older/newer posts exist

  • renet


    Hello together,

    I’m working on a template where I want to use pictures instead of text for the “Newer entries” and “Older entries” links.

    I tried something like <?php next_posts_link('<img src= [...] />', 0); ?>, but it didn’t work. So I took a look at the forum and tried <?php next_posts(0, false) ?> to just get the URL of the next posts listing page. But the disadvantage (of course) is that it displays the next/previous-images every time, even when there are no “more pages” to display.

    So my question: Is there a function/method to find out, if next/previous posts exist? Or is there even a more elegant way to get what I want (images instead of text links)?

    Thanks for your replies in advance! 🙂


Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi


    Forum Moderator

    Why not use CSS to insert the images?



    conditional statements:

    if(get_next_posts_link()) { do it }
    if(get_previous_posts_link()) { do it }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Function to check, if older/newer posts exist’ is closed to new replies.