WordPress.org

Ready to get started?Download WordPress

Forums

Function to check, if older/newer posts exist (3 posts)

  1. renet
    Member
    Posted 4 years ago #

    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! :)

    Regards,
    René

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Why not use CSS to insert the images?

  3. alchymyth
    Forum Moderator
    Posted 4 years ago #

    conditional statements:

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

Topic Closed

This topic has been closed to new replies.

About this Topic