Questions tagged [previous-post-link]

Used on single posts, this template tag displays a link to the previous post which exists in chronological order from the current post. This tag must be used in The Loop.

Filter by
Sorted by
Tagged with
0 votes
2 answers
18 views

Next/Previous Product with custom order by price & products inside the product category [closed]

How to create next/prev buttons that are price sorted and give results inside the product category you are in? This question has been asked multiple times and despite the multiple threads there wasn't ...
user avatar
0 votes
0 answers
13 views

How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?

I have a custom post type with this structure: First Parent 1st child of First Parent 2ndchild of First Parent 3rd child of First Parent Second Parent 1st child of Second Parent 2nd child of Second ...
user avatar
  • 149
0 votes
1 answer
19 views

Order by post_date does not work in Previous and Next post pagination

I have added a previous and next pagination with thumbnail for my single post template but it does not showing the correct previous and next post. Also, saw its showing the previous and next post ...
user avatar
0 votes
1 answer
60 views

Infinite next / prev post in single.php page

I have a question regarding this code. When the last entry appears in then "next" I show the same page all the time. In addition, I would like to add a thumbnail display of the next post and ...
user avatar
  • 3
0 votes
0 answers
38 views

ACF Relationship Previous Next links of CPT

I have a CPT for artworks with custom taxonomy for artists. Then I have another CPT for artists. The artist pages are basically the the page title (artist name) and a relationship field where you add ...
user avatar
0 votes
1 answer
44 views

prev/next post links with custom query

is it possible to use a custom query instead of taxonomy in previous_post_link()? Or do I have to build the prev/next links completely custom if I want to use them with a custom query? Thanks Stef
user avatar
0 votes
1 answer
27 views

next/previous post links for specific category when post belongs to multiple categories

I have a category called "Featured Photo" that is category ID 2. I want to create next-post and previous-post links that contain links only for the next and previous posts in category ID 2. ...
user avatar
  • 1
0 votes
1 answer
35 views

Wordpress post pagination continuous [duplicate]

I have these shortcodes which I am using as links in my front end to get the next post and previous post. When I get to the last post it just keeps reloading the last post again. How can I get it to ...
user avatar
2 votes
2 answers
59 views

Make `previous_post_link()` Function Show The Post After Next i.e. Jump A Post

Is it possible when using the previous_post_link() function to make it get the previous post after next i.e. make it skip a post. So if you're on post 5 in numerical order it skips to post 3? The ...
user avatar
  • 848
0 votes
1 answer
164 views

How to exclude posts by meta key value in the_post_navigation next prev links?

Context: We created a plugin, that allows posts to be either in web, mobile app or both. This is done via meta key. When shown only in mobile app mode, then its hidden from web. The plugin code, that ...
user avatar
1 vote
1 answer
405 views

Next and Previous Posts of Same Parent

I'm working on a website for a webcomic and I have a custom post type set up for comic pages. I have multiple series on the site and have made each comic page a child post of a parent (one parent for ...
user avatar
0 votes
1 answer
94 views

Prev/Next Navigation on Single Post Disappeared for Custom Post Type

Hope it's okay to ask this question here - I'm not really a developer. I've been using Dox theme for a friend's website, and we are ready to go live over the weekend and the Theme developer isn't ...
user avatar
0 votes
1 answer
50 views

Can't Add Pagination

I can't add a pagination to divide my posts between pages and navigate between pages. Currently all 20 posts I have loads at once. I want to add a pagination to the bottom of my Page and view posts ...
user avatar
0 votes
1 answer
28 views

Why would one specify multiple arguments when using get_previous_posts_link() which takes only one parameter?

I'm looking at some plugin code that looks like so: get_previous_posts_link(__('<span>&larr;</span> Newer', 'gc-sermons'), $total_pages When I look at the WP function reference for ...
user avatar
1 vote
0 answers
44 views

Show category from “Next post” and “Previous post” [edited]

Posts are marked in a level 3 category. For example: City (which has the upper categories: State and Country). - Country -- State --- City I would like the level 2 (State) category to be shown along ...
user avatar
0 votes
0 answers
35 views

Show category in Previous/Next links

In place of the word PREVIOUS and NEXT, I would like to display the level 2 categories of the respective posts. This is my current code: function twentyfourteen_post_nav() { $previous = ( ...
user avatar
  • 307
0 votes
0 answers
41 views

Change URL of previous posts and next posts link in Wordpress

I'd like to change the URL of the <?php previous_posts_link ?> and <?php next_posts_link ?> that are being outputted by Wordpress. Problem: When I am on my single page, I am getting ...
user avatar
  • 193
0 votes
1 answer
834 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 ...
user avatar
0 votes
1 answer
245 views

Next/previous post link to posts only within one or more specific categories

I have posts that are in multiple categories. I am showing a next/previous post link on posts that are in a specific category, regardless of how many other categories this post has. The links are now ...
user avatar
  • 42
2 votes
1 answer
103 views

Working with Next and Prev links in Single Taxonomy Templates

I am building an art gallery website using a custom post type "paintings". There is a custom taxonomy for categories called "painting_cat" where it can be "studio", "plein air" etc., and another ...
user avatar
  • 263
0 votes
0 answers
124 views

Using previous_post_link next_post_link but with a filter on a custom field

I have a wordpress site in which I have setup a custom field show_post of type True / False. Lets me control showing of posts of course. But I can't figure out in php when using previous_post_link ...
user avatar
  • 9
1 vote
1 answer
485 views

previous/next_post_link in the same sub-category?

As the title: is there a way to navigate between posts of the same subcategory using the previous_post_link and next_post_link functions? But maintaining however both the category and the sub-category ...
user avatar
  • 111
0 votes
1 answer
88 views

Dynamic next and previous post links

Is there any way to change the next and previous post links dynamically. By default the previous post link takes to the previous post. However I want it to link to some different post, that I posted ...
user avatar
0 votes
1 answer
245 views

next_posts_link not visible on first page

I cannot get the <?php next_posts_link(); ?> working in my custom post loop on the first page ( website.com/news). The funny thing is that <?php previous_posts_link(); ?> does work on the ...
user avatar
  • 1
0 votes
1 answer
33 views

Back, Next, and Previous links for the REFERRING term archive

I have a bit of a tricky one. I can figure out how to do back, previous, and next links for a specific taxonomy term, what I can't figure out is how to specify which term the user started viewing ...
user avatar
  • 337
1 vote
3 answers
4k views

next_posts_link not working in custom loop

I've created a custom loop for posts, that works with Bootstrap, in which, I've added pagination - however it doesn't seem to be working. It just shows an empty button... <?php $args = array( ...
user avatar
0 votes
1 answer
56 views

Wordpress next/prev links Issue

previous_post_link(); next_post_link(); this code should display previous link and then next link , its showing totally opposite , is this wordpress issue or this is something me doing wrong
user avatar
0 votes
0 answers
313 views

get_previous_post_link and get_next_post_link of custom post type that share custom field value

I have a custom post type called chapter. I'm trying to show the next chapter with something like the get_next_post_link() and get_previous_post_link(). I get the next chapter that is posted, but I ...
user avatar
1 vote
2 answers
2k views

Can I use get_adjacent_post for specific categories?

I want to get next and previous posts based on a particular category slugs. For example, some posts might have the "sports" category while another has the "tech" category. I was hoping to plug in a ...
user avatar
0 votes
1 answer
614 views

Previous/Next custom post links within custom taxonomy

I have seen this issue in quite a few threads so apologies if I've replicated an issue here but I've had no joy in attempting to implement the solutions I have found. I have a custom post type: show, ...
user avatar
  • 29
3 votes
1 answer
10k views

How can I get next post id after current post id for custom post type

Hello I am using WordPress custom post type. In this I need to get the post id of the next post which will be present in the custom post type. The issue I am facing is that this post id will be ...
user avatar
0 votes
0 answers
25 views

Url PrevPost after migration

I make a migration to another server with duplicator and I have a bug with the URL when I call this : <a href="<?php echo $prev_post->guid ?>"><?php echo $prev_post->post_title ...
user avatar
  • 15
0 votes
1 answer
101 views

How to know if the most recent article

I would like to know how to know if the next article is the most recent ? And if is not the most recent, dont' show the content (The right arrow and "Article suivant") please, Here is my current code ...
user avatar
  • 15
0 votes
2 answers
1k views

How to filter get previous post function by meta value DESC and post date DESC?

My loop displays featured posts and then posts in reverse chronological order. However when I use <?php echo get_previous_post(); ?> it grabs posts in reverse chronological order. How do I ...
user avatar
2 votes
1 answer
2k views

How to make my pagination loop continuously?

So I created some custom pagination for my single.php template to show next/previous posts at the bottom. However, the way it is working currently is linear(ie on the most recent post there is only a "...
user avatar
  • 363
0 votes
1 answer
1k views

previous and next post of same category on singlepost.php

I want to show previous and next posts of same category in wordpress My code is : <?php $prev_post = get_previous_post(); $next_post = get_next_post(); ?> &...
user avatar
0 votes
1 answer
213 views

Wordpress post next/prev not working

I'm trying to add next/prev links to my wordpress post. This is the code for it: <div id="demo"> <?php $the_query = new WP_Query( array( 'category_name' => 'Case Study', '...
user avatar
1 vote
0 answers
69 views

Using 'previous_post_link()' & 'next_post_link()' on single attachment pages

I have uploaded a selection of audio files via the media uploader. I can successfully open an attachment page (single.php) for each file. However, the 'previous_post_link()' generates the current ...
user avatar
  • 11
0 votes
1 answer
166 views

How do I modify the Previous and Next Page posts on blog pages to include "previous" and "next" before the links?

I want to add "previous" and"next" to the individual blogs since they only have the blog titles for the next and previous links. I want to keep the links and I am having a hard time using any of the ...
user avatar
2 votes
2 answers
413 views

Wordpress pagination link always leads to home page

I am making a pagination for this website by using a custom query and get_next_posts_link, get_previous_posts_link. The problem is that the link to older entries (get_next_posts_link) only works once, ...
user avatar
  • 121
0 votes
1 answer
994 views

Get next post in same category not working WP 4.7.4

I have posts which assigned 1 of 2 different categories. On the single post view i want to show a next and previous link of posts with the SAME category. This should be straightforward, i've tried ...
user avatar
2 votes
1 answer
418 views

connect last post with first post

next/prev from my first to last and the other way around cant find a solution for that i am using this code for next <?php next_post_link('%link','<img src="img-location"/>'); ?> and ...
user avatar
1 vote
2 answers
1k views

Previous_post and Next_post - Custom Post Type

I have a custom post type and using this function to add for posts, previous and next buttons. The problem is that within the custom post type, I have subcategories defined by a custom field ...
user avatar
  • 638
1 vote
2 answers
141 views

Previous/next post links displaying wrong category than is desired

I want my single.php to display posts in the same category for the previous and next posts underneath the post. The problem is that each of my posts belongs to multiple categories, and they are ...
user avatar
0 votes
1 answer
45 views

How to Navigate within Category? Lot of codes here on stackexchange didn't work

At present I am using the below code to navigate between previous and next post. <?php global $wp_query; if (is_single()) { ?> <div class="prev-navigation"> <?php ...
user avatar
0 votes
1 answer
99 views

I need to customize wordpress "previous" "next" links

I am a hubspot developer mostly, and hubspot has tokens for previous post link and previous post title, and the same for the next post and the images for these posts. You can use these to create ...
user avatar
  • 103
0 votes
2 answers
1k views

Displaying the author of next and previous posts in pagination?

I have set up links to the next/previous posts on my single.php template. Currently I am using <?php previous_post_link(); ?> and <?php next_post_link(); ?> which gives me the title of the ...
user avatar
  • 363
0 votes
1 answer
185 views

altering %title

I'd like to transform the result from %title in functions like next_post_link(). More specificaly, I created a function called short_title($title, $after, $length). The idea is to return the title ...
user avatar
3 votes
1 answer
512 views

WordPress previous_post_link exclude posts with multiple categories

I have a single-news page in WordPress where I am looping over all the posts and conditionally updating the previous and next buttons to exclude certain categories based on the current post's category ...
user avatar
1 vote
1 answer
183 views

Next Posts Prev Posts for Standard post format only

I am using the following functions in my single.php file to display links to Previous and Next posts: get_next_post(); get_previous_post(); I store them in 2 variables: $next_post = get_next_post();...
user avatar
  • 621