• I would like to set up a single post PER page with a previous post permalink on each page. I don’t have any problem getting one link per page, but previous_post doesn’t work on the home page. I’ve tried a number of queries as well… all to no avail.

    The key here is getting the Permalink. I have gotten the Page 2 link, but I don’t want that. I need the permalink for the second page, which is also the second post.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m also in the same boat, trying to get the HOMEPAGE to display the previous permalink page… for some reason it won’t do anything. Help would be great on this, thanks!

    Some template tags work only under certain query-types. next_post() and previous_post() are examples of this, as they only function on single post pages. However, you can reset the WP_Query object’s is_single property to *fool* WordPress into seeing your home page as a single post page (albeit temporarily in the example below) so it will display the previous post link:

    <?php
    $wp_query->is_single = true;
    previous_post();
    $wp_query->is_single = false;
    ?>

    Oh so lovely, thanks!

    Can somebody tell me why this won’t work.

    <?php
    $wp_query->is_single = true;
    previous_post_link('%link', false, '2 and 3 and 4 and 5 and 6 and 7');
    $wp_query->is_single = false;
    ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Previous Post Permalink on Home Page with Single Post’ is closed to new replies.