WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Next / previous posts link - How to disable output? (5 posts)

  1. akis
    Member
    Posted 4 years ago #

    There is a solution for this?
    Anything like get_next_posts_link() ?

    Thanks.

  2. MichaelH
    Member
    Posted 4 years ago #

    Using http://wingrep.com found a function called get_previous_posts_link in wp-includes/link-template.php

  3. akis
    Member
    Posted 4 years ago #

    Well, <?php echo get_previous_posts_link(); ?> in single.php doesn't seem to display anything.

  4. MichaelH
    Member
    Posted 4 years ago #

    previous_posts_link and next_posts_link only work in the loop.

    For a single.php use Template_Tags/next_post_link ...

  5. akis
    Member
    Posted 4 years ago #

    Like I said, I don't need output.

    Seems to work fine with this code.
    $previous_link = get_permalink(get_adjacent_post($in_same_cat = true, $excluded_categories = '', $previous = true)->ID);

    For next link, set $previous to false.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.