Skip to main content

Questions tagged [next-post-link]

Used on single post permalink, this template tag displays a link to the next 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
0 answers
8 views

next_post_link() - how to add url parameter

How can i append some url parameters to the next_post_link? Forexample "?objectcat=someCategoryName" <?php next_post_link( '%link', 'nächstes Ojekt', TRUE, '$url_object_categorie', '...
user1815920's user avatar
0 votes
0 answers
40 views

Prev/Next links that follow a custom menu order?

Is there a way to include prev/next links that follow a custom menu order? For example, let's say I have a custom menu set up like this: Project 1 Project 2 Subproject 1 Subproject 2 Project 3 I ...
Desi's user avatar
  • 1,209
0 votes
1 answer
41 views

copy wp-include/link-template to child theme

This is a 3(4) part question. I want to change some functions in the link template file, but don't want to mess with the core. Basically I want to make the next/previous buttons to link to the next / ...
Adam Larsson's user avatar
0 votes
1 answer
50 views

How to add thumbnail support to WordPress next / previous post loop?

I'm using the following code snippet for the next/previous navigation loop in Single.php. <?php $nextPost = get_next_post(); if($nextPost) { $nextPostID = $nextPost->ID; ?> ...
NORDc's user avatar
  • 1
1 vote
0 answers
40 views

on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query

Current behavior I have a media page that uses a custom WP_Query to return all thumbnails of media library attachments (regardless of post parent) with a custom taxonomy of media_visibility that has ...
Mike Eng's user avatar
  • 268
0 votes
1 answer
29 views

Is there a function to modify existing previous/next post link without modifying theme files?

I was hoping to be able to just add a function just to keep the previous/next post links within the same immediate (not parent) category. Everything I've been able to find so far includes modifying ...
CindyH's user avatar
  • 13
0 votes
2 answers
403 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 ...
John Aps's user avatar
0 votes
0 answers
117 views

Trying to get_adjacent_post - in same category not working

this is my first time here. I need my previous and next posts to show only posts on the same category. But I don't know how to do it. This is the code in my template (called Valenti) it is in a file ...
lalulula's user avatar
0 votes
1 answer
224 views

How to get next and previous post into ajax formed modal windows?

On the archive page, by clicking on a news item, I need to implement the appearance of news in a modal window. Well, there is nothing difficult here if you use ajax. Here is my js code: const newsItem ...
Victor Sokoliuk's user avatar
0 votes
1 answer
50 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 ...
Yajuvendra's user avatar
0 votes
1 answer
158 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 ...
GGQa's user avatar
  • 3
0 votes
1 answer
150 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. ...
jonzal's user avatar
  • 1
0 votes
1 answer
70 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 ...
Joel Reed's user avatar
1 vote
0 answers
60 views

Change OR logic of get_adjacent_post into AND

" AND tt.term_id IN ( $term_array )" get_adjacent_post uses an OR logic to find next/prev posts with identic terms of the current post, via the IN operator, and I would like to change that ...
Adam Alleman's user avatar
0 votes
0 answers
332 views

Wordpress Frontend Page using Plugin

I'm trying to create a front-end page using the WordPress custom plugin where I want to create a custom registration page. I have created a boilerplate plugin, where I can only activate and deactivate ...
Ramesh KR's user avatar
  • 101
0 votes
1 answer
313 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 ...
Kalle H. Väravas's user avatar
1 vote
1 answer
824 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 ...
ZackAkai's user avatar
0 votes
1 answer
166 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 ...
uchijjang's user avatar
0 votes
1 answer
1k views

Blog home page has canonical link that is incorrect. Do not see where to change this

As part of our website we have a wordpress blog in a subdirectory. I scanned our main site for broken links. The scan included the wordpress blog in the subdirectory. Some "broken links" ...
Jeffrey Simon's user avatar
0 votes
1 answer
382 views

Infinite looping next post link within a certain category on a post

I'm looking to create an infinitely looping 'next post' link at the bottom of a post that only links to posts in that category. So if I have three posts in the same category – 1, 2 and 3 – it should ...
zackwww's user avatar
1 vote
0 answers
30 views

Get Prevous/Next Post Specific Category Without Excludes

Is it possible to mimic the get_next_post / get_previous_post WP functions without using the $in_same_term boolean / $excluded_terms array pattern? I have a site with many overlapping categories that ...
HarrisonFM's user avatar
0 votes
0 answers
52 views

Why next_posts(); function does not work inside header.php?

Why does next_posts(); function does not work inside header.php whereas it ^does work^ inside temlate-homepage.php ? My code below: <?php // Query ALL posts ordered by random $args = array( '...
Piotr's user avatar
  • 111
1 vote
0 answers
53 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 ...
MaryJenny's user avatar
0 votes
0 answers
43 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 = ( ...
BobGCA2's user avatar
  • 317
0 votes
0 answers
73 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 ...
Siyah's user avatar
  • 193
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
0 votes
1 answer
359 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 ...
TASan's user avatar
  • 42
2 votes
1 answer
126 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 ...
RiotAct's user avatar
  • 293
0 votes
0 answers
192 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 ...
Mike's user avatar
  • 9
0 votes
0 answers
296 views

get_next_post() not working with future post status

I'm using in single post template simple navigation below the post content: $next_post = get_next_post(); if($next_post) { $next_title = strip_tags(str_replace('"', '', $next_post->...
Ondřej Vala's user avatar
1 vote
2 answers
65 views

Restrict next_post_link() to current category

The Codex disagrees with itself, so I'm stumped. On single.php I am trying to use next_post_link() to display a link to the next post, with custom link text, within the same category as the current ...
WebElaine's user avatar
  • 9,485
1 vote
1 answer
613 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 ...
claudio's user avatar
  • 111
0 votes
1 answer
507 views

how to overwrite next_post_link

Is there any custom php code that lets me overwrite next_post_link so I can customize it to my liking? I can add code in functions.php Right now it shows next post But I want to show something else
Born vs. Me's user avatar
0 votes
1 answer
299 views

make random internal linking in the middle of posting

i mean like in the middle of the article, i will put a link that link to a random post in my website. i'm new with this thing. and i'm trying to find a solution, because i've tried with a plugins, ...
dedemith's user avatar
0 votes
1 answer
190 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 ...
Pankaj Prakash's user avatar
0 votes
1 answer
338 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 ...
cero's user avatar
  • 1
0 votes
1 answer
1k views

How to get next post and previous post URL in loop, single.php My WordPress 4.9.6

I want to show next previous button in single.php please suggest me the possible way, I'm stuck at these point in my site development Next Previous > <?php posts_nav_link(); ?> <?php &...
Mehul's user avatar
  • 1
0 votes
1 answer
40 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 ...
Mattaton's user avatar
  • 367
1 vote
3 answers
5k 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( ...
Jake Punton's user avatar
0 votes
1 answer
63 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
Maria Asghar's user avatar
-1 votes
1 answer
34 views

Exactly where I have to insert get_next_post_link() in a post?

Currently I'm working on a website, where there are posts and I intend to give the possibility the user to jump to the adjacent posts with a simple link pointing to them. It will be with ...
Geeocode's user avatar
  • 161
0 votes
0 answers
399 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 ...
Kaye O'Malley's user avatar
1 vote
2 answers
3k 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 ...
bigmike7801's user avatar
0 votes
1 answer
836 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, ...
mtm's user avatar
  • 43
3 votes
1 answer
12k 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
1 answer
114 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 ...
sbzc's user avatar
  • 15
0 votes
2 answers
2k 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 ...
Nick M.'s user avatar
2 votes
1 answer
3k 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 "...
user13286's user avatar
  • 255
0 votes
1 answer
2k 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(); ?> &...
varsha 's user avatar
0 votes
1 answer
219 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', '...
tasmanianDevil123's user avatar