• Hi

    My index.php only has one post, and is identical to the single.php. The previous_post_link does not work on the index.php page but does on the single.php.

    Any ideas how I can implement it on the homepage?

    Or how I can get the homepage to act like the single.php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s because previous_post_link is meant only for the single.php template file. If you want to move back in the archives from the index page, you need to use the posts_nav_link or the next_posts_link/previous_posts_link. (note the use of the plural in “posts”).

    I’ve got a similar issue — when I use next_posts_link or posts_nav_link, the navigation controls cycle through pages of posts instead of permalinks.

    Right now, clicking back from the index page brings me to site.com/page/2, when what I want is to cycle through permalinks — i.e — site.com/nameofpreviouspost.

    Is there any way for wordpress to do this?

    *bump*

    I have a single-post blog. One post per page. There’s a simple navigation menu on the index page — I need it to point to the most recent permalink, not the archive page.

    Right now, I’ve resorted to coding a new blog from scratch. I’d rather not spend two weeks coding if possible.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘previous_post_link on index.php?’ is closed to new replies.