- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m having a problem getting this pagination working it always shows 404 error when I click next.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('post_type' => 'portfolio','posts_per_page'=> 9, 'order' => 'DESC', 'paged' => $paged );
query_posts( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post();?>
- ">
if ( has_post_thumbnail() ) {
the_post_thumbnail('portfolio-thumb');
}
?>
//Pagination
if(function_exists('my_paginate_links')) {
my_paginate_links();
}
endif;
wp_reset_postdata();
wp_reset_query();
?>
& here is the pagination function
function my_paginate_links() {
global $wp_rewrite, $wp_query;
$wp_query->query_vars > 1 ? $current = $wp_query->query_vars : $current = 1;
$pagination = array(
'base' => @add_query_arg('page','%#%'),
'format' => '',
'total' => $wp_query->max_num_pages,
'current' => $current,
'prev_text' => __('« Previous page'),
'next_text' => __('Next page »'),
'end_size' => 1,
'mid_size' => 2,
'show_all' => true,
'type' => 'list'
);
if ( $wp_rewrite->using_permalinks() )
$pagination = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
if ( !empty( $wp_query->query_vars ) )
$pagination = array( 's' => get_query_var( 's' ) );
echo paginate_links( $pagination );
}
So what’s wrong & how can I fix this?
Thanks.
anyone :)?
Any chance you can show how this ends up on the site? Where do the pagination links point to?
The pagination link is /page/{page number} so when I click next page /page/2/ I get the 404 page.
Unfortunately I can’t show the site.
Do any other permalinks work? Like http://www.yoursite.com/hello-world and such?
Yeah the whole websites links works perfectly it’s just the pagination links