Pagination on my website not working, everything else is fine, But when i click to go to "/page/2/3/" it shows no page found error.
Website : http://savemoney.16mb.com
Error pages: http://savemoney.16mb.com/page/2/
and currently Front Page set to "Latest Posts" (Not Static Page)
Pagination Code (Frontpage.php):
<?php
// show all coupons and setup pagination
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
query_posts( array( 'post_type' => APP_POST_TYPE, 'post_status' => $post_status, 'ignore_sticky_posts' => 1, 'paged' => $paged ) );
?>
<?php get_template_part('loop', 'coupon'); ?>`
Any advice on how to get this pagination working correctly would be appreciated!
Thanks,
T
have you tried , "add_args" => false ?
here is more info for that https://core.trac.wordpress.org/ticket/30831
Related
I'm trying to configure the Wordpress pagination in de Index homepage.
I've used the WP_Query with the regard of get_query_var('paged') before, just as the code shows:
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$query = new WP_Query( array(
'cat' => 7,
'posts_per_page' => 2,
'paged' => $paged
) );
?>
Then I used the native Wordpress function previous_posts_link() to go back onte the list of posts.
The problem that happens is that when the page loads, the url of the page changes, but the posts that shows are the same as before. Even to page 3 or 4, it just shows the same list of pages.
Where am I going wrong?
Currently I am trying to get wordpress pagination to display at the bottom of the page but nothing shows up, if I echo out "paged" it outputs 1 so I believe it is correctly reading the page it is on. The loop I am using is as follows:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'company_list', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => 6, 'paged' => $paged);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
To echo out the actual pagination at the bottom of the page I am using:
echo paginate_links( $loop );
Currently no pagination is being displayed at the bottom of the page but the loop is working correctly. The page is also not set as a static front page.
Thanks.
1)You do not have to use question mark in your first row
$paged = (get_query_var('paged')) ?
2)also see :
https://stackoverflow.com/a/33757648/10210277
I have created a Custom Post type and its page template, i want pagination on my custom post type page template
<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1;
$qry = array(
'post_type' => 'property',
'posts_per_page' => '3',
'oerder' => 'ASC',
'page' => $paged,
);
$listing = new WP_Query($qry);
if($listing->have_posts()):
while($listing->have_posts()):
$listing->the_post();
the_title();
endwhile;
endif;
?>
I am using page_navi Plugin for pagination but its not working,
I am also using the wordpress pagination , here is the code
<div class="nav-previous alignleft"><?php get_next_posts_link(); ?></div>
<div class="nav-next alignright"><?php get_previous_posts_link(); ?></div>
but its also not working.
Please Suggest me some Solutions ASAP
Thanks
So that I can just submit this and have you look into this a little easier with some explanation.
It is not page for pagination in Wordpress. It is paged.
So your query should be....
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // changed all page to paged
$qry = array(
'post_type' => 'property',
'posts_per_page' => '3',
'order' => 'ASC', // This was spelled wrong...
'paged' => $paged, // changed page to paged
);
see http://codex.wordpress.org/Pagination#Adding_the_.22paged.22_parameter_to_a_query for full documentation on how to set the paged variable and use it correctly.
Your order was spelled incorrectly and as that is just above paged it could potentially mess something up, but highly doubtful. I would correct it for the expected execution.
Here gallery is custom post type.
function get_all_gallery_posts( $query ) {
if( !is_admin() && $query->is_main_query() && is_post_type_archive( 'gallery' ) ) {
$query->set( 'posts_per_page', '6' );
}
}
add_action( 'pre_get_posts', 'get_all_gallery_posts' );
I have a custom query that uses an array merge so I can list articles and custom post type posts in one list, showing 5 at a time. Pagination below allows the user to see the rest of the results. I keep getting pagination errors, but I've tried virtually every variation of the $paged variable in my query to get pagination to work and it doesn't. I know it's me, and probably a simple syntax thing...but I'm stumped. Any ideas? (Note: this page has multiple, other custom queries above the one in question)
Here's my code:
<?php
$loop1 = array_merge( $wp_query->query,
array( 'post_type' => array('post','podcasts', 'cat' => $cat_ID ),
'paged' => ( get_query_var('page') ? get_query_var('page') : 1 ),
'posts_per_page' => 5 ) );
query_posts( $loop1 );
while (have_posts()) : the_post(); ?>
have you tried?
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
With wordpress I am trying to figure out how to get the current page number and use it with the query_posts function i have tried passing in page=1 but that doesnt seem to work
query_posts( "cat=4&posts_per_page=1" ); // how do i pass in the page number???
query_posts( array( 'cat' => 8, 'posts_per_page' => 25, 'paged' => get_query_var('page') ) );