Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [previous]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
96 views

Display two previous posts on single.php

At the bottom of single.php, I want to display "card" links to the next and previous posts in chronological order. This is pretty easy thanks to get_next_post() and get_previous_post, no ...
doofusb0y's user avatar
1 vote
0 answers
51 views

Next Previous siblings child pages

I tried this piece of code : https://wordpress.stackexchange.com/a/54474/80921 because I couldn't figure out how to get the next and the previous post. But this code won't work now and I'm not able to ...
sugardaddy's user avatar
0 votes
1 answer
1k views

Get previous/next post from (specific) category

I have posts with two categories, for example, 1st post is in category "product" and "shoes", 2nd is in category "product" and "shirts", 3rd is in category "product" and "sport clothes"... So, posts ...
Advanced SEO's user avatar
1 vote
0 answers
564 views

get_adjacent_post() returning weird results

I am using get_adjacent_post() function to display links to a previous and next post. It is a custom post which also has a custom taxonomy. This is the code I am using: $prev = get_adjacent_post(...
Kristián Filo's user avatar
1 vote
1 answer
3k views

get_previous_post not working as expected

I have used get_previous_post to get the previous post of my custom post type. When I try that by doing $prevPost = get_previous_post(); var_dump($prevPost); I get a post object containing my ...
Jamie's user avatar
  • 1,363
1 vote
3 answers
3k views

Next and Previous loop

I am making a wordpress site but i need little help, What I have is a function with Next and Previous buttons to list projects, but when i go to the last project the Next button is gone. What I want ...
DroDro's user avatar
  • 17
-4 votes
1 answer
12k views

Add a "Next Post" & "Previous Post" styled button manually to a post

Can anyone walk me through the exact steps? I want to create two buttons that sit next to each other at the bottom of a post for the NEXT and PREVIOUS posts...I want to be able to insert this ...
Dara's user avatar
  • 3
0 votes
0 answers
28 views

Decrement term in for each

So I am catching custom posts in wordpress by for eaching my custom terms. To get a post from the next term in the loop I use $terms[++$key]->name and it all works fine. However when I want to do the ...
DaViDa's user avatar
  • 103
0 votes
1 answer
1k views

Get previous posts list

I'll give up. Have searched and searched and tried and tried... Can't find any solution to list previous posts. On a single post: I want to show a list of the 10 previous posts, the 10 before the ...
Peter Westerlund's user avatar
0 votes
2 answers
56 views

Wordpress The Next Posts

So for previous and next posts I used this from wordpress codex <div class="navigation"> <p> <?php posts_nav_link('&#8734;','Go Forward In Time','Go Back in Time'); ?&...
Karuw's user avatar
  • 1
0 votes
1 answer
823 views

Display NEXT and PREVIOUS pagination? [duplicate]

I need help on the pagination. I try to put the NEXT and PREVIOUS pagination that show the post in a same category, but I am not sure what happen that showing nothing. If you can help, much thanks! ...
user3089026's user avatar
1 vote
1 answer
979 views

next and previous year month and day for archive page

is there php code for next and previous year,month,day link in archive page i just need something like that <-previous [year] next-> <-previous [month] next-> <-previous [day] next->...
Mouner Mostafa's user avatar
0 votes
1 answer
52 views

Previous and older set of posts links

I can't seem to display previous and older set of posts links. This is the page I am working on. I need a link to older and newer posts at the bottom of page. The template code is like this: <?...
Aksel Gümüş's user avatar
0 votes
1 answer
59 views

Display different css or Information based on previous page

I've run into a bit of a tricky problem that I'm probably over thinking. I need to be able to display different css depending on what campaign page the user has come from. To better illustrate: ...
user3766356's user avatar
2 votes
2 answers
5k views

How to make Next and Previous attached image navigation on the attachment page? [duplicate]

How to make Next and Previous attached image navigation on the attachment page? ' . __( 'Previous Image', '$text_domain' ) . '' ); ?> ' . __( 'Next ...
user45239's user avatar
0 votes
2 answers
2k views

Category foreach Paging

I'm using the following code to display categories on my homepage, what I'd like to do is add the ability for paging with previous and next links, I haven't been able to figure out how to do this with ...
Josh Rodgers's user avatar
  • 1,173
2 votes
1 answer
2k views

Loop - how to get previous/next post for first/last post?

I have a simple loop for a JS slider, I want to display previous and next posts titles on my slide, but I can't get previous post title on the first slide (because apparently first post have no ...
Wordpressor's user avatar
  • 5,041
0 votes
0 answers
316 views

Getting meta content from get_next_post & get_previous_post

Is it possible to retrieve meta content for the get_next_post() and get_previous_post()? I'm currently using the following method, but not having much luck: <?php $prev_post = get_previous_post();...
Marc P's user avatar
  • 513
0 votes
1 answer
5k views

How can I change the prev / next buttons text to Dutch?

If you look to this page everything is alright except the previous and next buttons text are in English. Does anyone know how I can make them display in Dutch? I already tried to change them but no ...
user1052732's user avatar
0 votes
1 answer
177 views

get next/previous post name

i know that : <?php $pagename = get_query_var('name'); ?> get the name of the current page/post. But I dont know how to get the name of the next and the previous post. I will use it for a hover ...
menardmam's user avatar
  • 882
0 votes
1 answer
204 views

Footer with next/previous posts

I'm looking for something to create a multi footer with previous / next posts. The footer needs to know if the current post is the newest (1st, 2nd and 3rd newest), oldest (3rd, 2nd, and oldest) or in ...
rwzdoorn's user avatar
  • 375
0 votes
2 answers
2k views

Previous and Next Navigation buttons take the user to the wrong posts

I am currently developing a portfolio section on my website and when the single posts are viewed, there are some previous and next links to take the user to the next post. Upon reaching the first ...
Jonathan Beech's user avatar
0 votes
1 answer
628 views

How To Show Get Adjacent Posts If Posts Are Sorted By Custom Field

I want to get the ID of adjacent posts. For posts sorted chronologically you can use: get_adjacent_post Are there any standard methods for finding the adjacent post if the posts are sorted by ...
dorich's user avatar
  • 177
0 votes
2 answers
84 views

Is that the query_posts() the real criminal here?

<div class="single_post"> <?php // The Query query_posts( $args ); // The Loop if(have_posts()) : while ( have_posts() ) : the_post(); ?> <div class="...
Shahriar Kabir's user avatar
2 votes
2 answers
162 views

Cache previous versions of website?

I'm working on a new site for a charity. They publish a printed magazine & we would like the website to always reflect the current issue of the magazine. So far I have a front page (home page) ...
speedypancake's user avatar
0 votes
1 answer
1k views

Next Page & Previous Page links - skipping a single page - how?

On my Wordpress webpage, I have several Pages. Now I want to display "Next Page" & "Previous Page" links. I know that there are several ways out there to do this, but they all fail because I want ...
Sven's user avatar
  • 371
0 votes
3 answers
391 views

Add title for previous and next posts to Yoko Theme

Help! I want to change my "Previous" and "Next" post links to use the actual post titles. I have done all kinds of online research and code manipulation without any success. I am using the Yoko theme....
Erin's user avatar
  • 1
0 votes
3 answers
2k views

Show multiple next and previous posts

I've created a portfolio with single posts. When viewing the posts i'd like to show the next / previous 2 posts (portfolio items). Currently i'm using the following code but only shows one post: &...
rwzdoorn's user avatar
  • 375
0 votes
2 answers
120 views

Styling Previous/Next Pages differently from Index

A friend of mine pointed me towards using child elements to style my index page so that I could have one loop and several different visual styles (a featured post, a smaller sub-featured post, and ...
crdimalla's user avatar
0 votes
1 answer
1k views

Plugin: Events manager - Next and previous event

I'm trying to get a navigation in the events of event manager the next/previous post links work but they are ordered by creation date instead of event date. How could it be possible to change this?
Piet Venema's user avatar
0 votes
1 answer
3k views

how to add previous and next link for the posts?

i would like to know how to link the next and previous post of the current post with in that category..i tried lotta plugins put nothing worked out and I am a noob in WP so kindly help me
Felix's user avatar
  • 333
2 votes
1 answer
445 views

Previous & Next on Index Page broken

So the Next/Previuos on my index page is broken. It goes to page 2 but doesn't refresh the posts. It will work on my categories and it will work on my posts but it just won't work on the from page. ...
Howdy_McGee's user avatar
  • 20.7k
7 votes
2 answers
20k views

Get previously visited page ID

I would like to get the ID (or permalink) of the page the visitor visited just before visiting the current page - in other words the ID of the last page in the browser history. Can this be done? Any ...
ptriek's user avatar
  • 857
1 vote
1 answer
927 views

Posts archive index pagination in a static page custom query

In WordPress, I have a page for News that is using a specific page template I created. This page is populated by news posts assigned to the news category. I need to show only two of the latest news ...
IntricatePixels's user avatar
1 vote
1 answer
3k views

get_previous_post in same categories

I have a post in two categories, 1 and 2. I want to get the previous post in the two categories, 1 and 2. get_previous_post(true); With that code I'm getting the previous post in category 1 or 2. ...
fsinisi90's user avatar
  • 113
3 votes
1 answer
797 views

Get next/previous cousin page

Hey Guys, I'm trying to build pagination links for the next/previous cousin page. For example, my page structure is like this: Top Level A a1 a2 B b1 b2 When I'm on a2, I want the 'Previous Page'...
Drew Baker's user avatar
8 votes
4 answers
13k views

Get Next / Prev 3 Posts in Relation to Current Post

I have 7 posts, like this: 1 2 3 4 - this is the current post 5 6 7 As noted, number four is the current post being displayed. I need to create a query that will allow me to display the previous 3 ...
Pippin's user avatar
  • 4,886