Questions tagged [paged]
The paged tag has no usage guidance.
62
questions
26
votes
3
answers
41k
views
How to determine if I'm on the first page of pagination?
How do I determine if I'm on the very first page of pagination? I'm using WP_Pagenavi. I want to run a function only on the first page of the pagination. I checked the query_var 'paged', it's set to 0 ...
9
votes
1
answer
16k
views
What is the difference between $paged and $page?
I'm creating pagination for my site. Hope everyone can explain to me what below code used for? Thanks in advance.
<?php
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} ...
9
votes
2
answers
2k
views
How can I create a category landing page followed by pages of posts?
I'm trying to create a category template in my theme that will display static content if the user is on the first page of the archive, and then display the posts in the category on the following pages....
7
votes
4
answers
36k
views
get_query_var( 'paged' ) not working outside of homepage
Twenty Eleven Theme...
On the home page, I have successfully filtered the loop to display just "Featured" posts with pagination functioning properly through nav links. I'm trying to display posts ...
5
votes
1
answer
8k
views
Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
OK, so i'm messing with Custom Taxonomies for the second time and in both instances i've run into this problem where using the posts_per_page argument in either a query_posts or WP_query scenario.. ...
4
votes
1
answer
6k
views
Get the number of posts from the current page results
I am trying to get the current number of posts that will be present in a page.
$wp_query->found_posts will give me the total number of posts in the loop.
get_query_var( 'posts_per_page' ) will ...
3
votes
2
answers
2k
views
Why does pagination always break when used on any form of a home page?
Why does WP pagination break when used on the homepage?
If you take the code below and use it in a page template it works perfectly (make sure you have 3 or more posts). However, as soon as you use ...
3
votes
3
answers
5k
views
Pagination not working on custom query
I am trying to change pages when I search by category on my website. When I am not searching under a certain category I can switch pages fine but when I am searching for a category I am unable to ...
3
votes
1
answer
137
views
Change page /2 to /transcript with a Rewrite
I set up this rule (in functions.php)
function custom_rewrite_basic() {
add_rewrite_rule(
'episode/([^/]+)/transcript',
'index.php?post_type=episodes&episodes=$matches[1]&...
3
votes
2
answers
311
views
How can I display 7 posts on the home page, but 9 posts on the subsequent pages?
The home page of my site is set to show the 9 latest posts (via the setting in the admin area), and then at the bottom I have the standard pagination links which allow visitors to view more posts.
I ...
2
votes
4
answers
14k
views
Using $paged redirects /page/2 to page 1
I've setup a custom query for my posts (single.php) with pagination, which by the way is working great with the default permalink structure.
domain.com/p=ID&paged=2
if I switch the permalinks ...
2
votes
3
answers
1k
views
Customized first post techniques
There doesn't seem to be a standard technique for differentiating first/top posts. After looking around, I found this method:
$current_query = new WP_Query('post_type=current&post_status=publish')...
2
votes
2
answers
5k
views
$wp_query->current_post restarts from zero on paged pages
I know how to keep track on the 'index' of the current post when running the loop using
$wp_query->current_post
Bu this restarts the count from zero on subsequent paged pages. So if I have 20 ...
2
votes
1
answer
3k
views
Merged two WP_Queries, posts per page and pagination not working
I merged two WP_Queries with the code below, it has pagination setup as well as posts per page in the final combined object but those settings aren't working. My page shows 24 posts, where is it ...
2
votes
1
answer
521
views
Paginate_links won't create the right links on a taxonomy filtered custom post type archive
after hours and dozen of tests and messes... i'm face to the wall and fed up searching (mainly cuz my google's answers are already all clicked !)
I'm trying to display paginate_link with a filters ...
2
votes
2
answers
3k
views
Customising rewrite rules for CPT single post URL to work as paged URL
I've got a CPT called Service registered as following:
$args = array(
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'has_archive' => false,
'...
2
votes
1
answer
3k
views
Last comment page first with full number of comments?
I use paged and threaded comments with:
10 comments per page
the last comment page first
the newest comments first
If there are 21 comments total, the first page only contain 1 comment - the newest. ...
1
vote
2
answers
3k
views
Get current page number of splitted article
I am trying to find a way to get the current page number of an article that has been splitted into several pages with the use of:
<!-- nextpage -->
There is an example that can be found here:
...
1
vote
1
answer
1k
views
'paged' in wp_query doesn't work
I try to add a code to my wordpress blog show previous posts(in a previous page).
I try this code but it don't work:
<?php
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$args = ...
1
vote
1
answer
82
views
using is_paged for hiding image on posts
In my posts I'm using <!--nextpage--> in order to paginate specific blog posts, which works fine. But my issue is that the featured image shows in the post header for each page.
I've tried using ...
1
vote
2
answers
433
views
Does it make sense to assign functions like is_paged() to a variable rather than using it multiple times?
Actually a simple question, but I need to be sure that assigning a variable for the result of a function can help to increase the speed of a site e.g.
The function: if is_paged(){ $paged = 1; }
The ...
1
vote
2
answers
4k
views
Custom posts per page does not work with pagination
I have one page in my template where I would like to set a custom posts_per_page.
Here is the code I have used:
<?php
global $query_string;
query_posts($query_string . '&posts_per_page=4');
...
1
vote
2
answers
710
views
Cannot go back to the first paginated page using pagination links
I embedded standard code for pagination links and everything is working fine except that clicking the Previous or Page 1 link does not take me back to the first paginated page. This is different from ...
1
vote
1
answer
10k
views
Pagination on category page with custom post types
Wordpress is not new for me but I am really stuck on this piece of code that I can not get to work properly.
I register a custom post type News and let the custom post type use the Wordpress ...
1
vote
1
answer
133
views
paged > max_num_pages won't throw 404
I've created new page in WP administration called Blog and created custom page template for it. In the template, I have a simple paged custom query.
$query = new WP_Query(array( 'post_type' => '...
1
vote
1
answer
676
views
$paged always 0 on plugin's custom page
I'm making a plugin that loads a specific template depending on a certain query var being passed, in effect creating a page for the plugin on the front end, as outlined in this post:
Create a page ...
1
vote
0
answers
94
views
Masonry, WP_Query & paged - first page repeating, second page not loading
I'm tearing my hair out over this. I've been tasked with some legacy work on a quite an old site. They have a template for a custom post type called resources.
This template has search/filtering ...
1
vote
0
answers
138
views
Shortcode not working with post counter
I am trying to make this a Wordpress shortcode, i mean the below code, but it doesn't seem to work , I included this in my function.php file, but it gave back multiple query result, as seen in the ...
0
votes
3
answers
1k
views
Using next/previous_posts_link with customised search
I have a few different searches on my website:
"Species profiles" (custom post type search)
"Glossary" (custom post type search)
Generic, site-wide search
Currently I'm using search.php; $_POST["...
0
votes
2
answers
598
views
Querying posts only if the current page is not paged?
For example, I want to query posts in a page. But I don't want to show them when the user clicks the pagination links.
Pretty much like what happens in Youtube. You only see the Top comments in the ...
0
votes
1
answer
182
views
Custom WP_Query always respond with 200 status even when no entry
I'm using a custom WP_Query. The code is something like below:
$portfolio_args = array(
'post_type' => 'portfolio',
'posts_per_page' => 5,
'paged' => ...
0
votes
1
answer
764
views
"paged" in WP_Query returns 0 posts
If i don't supply a paged value (get the first page), it works. But when i try to get the next page by doing paged => 2 it doesn't find anything even though there are plenty of posts to get.
That'...
0
votes
1
answer
408
views
Archive template combined with post slider and regular posts
I am trying to find the best and easiest way of modifying my archive.php template to contain slider on top which slides the 4 first posts and the rest (6) will be displayed beneath as a regular posts.
...
0
votes
1
answer
189
views
Differnt page template for page 2 of blog feed
Is there a way I can use one page template (A custom page template for example) for the first page of my blog and then another template (Index.php for example) for page 2, 3, 4, etc.?
0
votes
1
answer
2k
views
Difference between $numpages & $max_page on archive pages
After taking a look at global $max_page; and global $numpages; on category-archive pages (is_archive() || $GLOBALS['wp_query']->is_archive returning true), I see the following return values:
$...
0
votes
2
answers
1k
views
Get paged outside of loop?
Is it possible to get paged outside of the standard WP loop?
I already use this inside the loop:
<?php if ( $paged >= 2 ) { ?> Some text for the 2nd page on up <?php } ?>
But I'd ...
0
votes
1
answer
286
views
Pagination on template page for custom query redirecting to index.php
I'm building my first theme and have a template page "page-blog" with a custom wp_query. I've tried adding pagination to the query but so far the pagination redirects to the index page. As ...
0
votes
2
answers
86
views
Determine if, within a post, you are on page 2 or greater - Wordpress documentation circular
I am trying to run a function that executes only on the first page of any post. So, if a post is paginated because you have used the <!--nextpage--> tag and you are on page 2 or greater of that ...
0
votes
2
answers
7k
views
Disable pagination in posts and pages
I need to solve duplicating of posts and pages caused by unexpected paging. I am trying to disable the paging with this function, but it seems I miss something:
function wpse_disable_pagination( $...
0
votes
1
answer
3k
views
How to list custom post types on a custom post type page?
I would like to know why my custom post type pages do not accept paged pages?
On a normal page I can list custom post types without problems, but on a custom post type page, it seems impossible. I ...
0
votes
1
answer
44
views
Pagination, query more pages at once
I'm wondering if it is possible to do such thing on Wordpress, I have an infinite scroll to display my posts, I'm keeping track the pages updating the url:
mypage.com/news/?pag=3
and I have a code ...
0
votes
1
answer
64
views
Get a link to paged(<!--nextpage-->) part?
I want to get a link (like get_permalink($id) ) to it's specific page of a post (created by <!--nexpage--> tag)..
how to achieve this?
0
votes
1
answer
2k
views
WP_Query orderby random do not repeat infinite scroll - one loop
I have found a lot of documentation on solving this issue with multiple loops, I'm finding it hard to see a solution for one custom loop.
Problem: I'm using infinite scroll to load in the next page ...
0
votes
1
answer
4k
views
filter posts by meta key with pagination
Trying to filter out specific posts that have certain meta_key from the main query... problem is it doesnt work with pagination which is my issue here.
Anyone knows how to solve this?
$paged = (end( ...
0
votes
2
answers
2k
views
Having a variable based on $post_count increase when i move to the next page of results
I couldn't figure out the best way to write the title, so first of all I hope you understood what i was trying to get across. I have a snippet of code on my template page that fires after the wp_query ...
0
votes
1
answer
20
views
Paginate_Links page 2 doesn't work
I have a custom query that can a list that can be up to around 20 items, so it needs pagination. It is displaying the correct amount of pages for how many items, but when clicking it it refreshes and ...
0
votes
1
answer
615
views
Numbered Pagination Showing The Same Posts After Altering WP_Query
I think the title sums the problem up, but I'll explain more with the code below.
As you can see, I'm trying to start the loop from the second latest post for some theme reasons which forced me to ...
0
votes
2
answers
104
views
div show on home page only not in paged
im using this piece of code to show my div only on homepage.
<?php if ( is_front_page() ) :?>
but it's shown on pagination 2, 3 and so on. is there any help regarding to fixing this issue?
0
votes
0
answers
216
views
Rewrite Rules, Query Vars and Pagination
Putt a lot of research in and did a lot of testing for this issue and I don't think I am going to solve this by myself at this point.
What we have:
A page with a permalink with one shortcode.
That ...
0
votes
0
answers
511
views
Pagination diplays always 2 pages
I have a problem with the pagination its working great with blog page, but when i want to show custom post type it shows always two pages even if it contains just one post.
P.S. I modified in my ...