pagination leads to 404 page

After an exhausted effort of a whole day finally find the solution. i write these two functions in my functions.php file and finally i got the expected result. function remove_page_from_query_string($query_string) { if ($query_string[‘name’] == ‘page’ && isset($query_string[‘page’])) { unset($query_string[‘name’]); // ‘page’ in the query_string looks like ‘/2’, so i’m spliting it out list($delim, $page_index) = … Read more

paged query leads to 404? [duplicate]

A couple of points you should try out: Remove the ‘paged’ => $loop->query_vars[‘paged’] from your $pagination array. It’s not a parameter in the docs. Remove the ‘base’ => @add_query_arg(‘paged’,’%#%’) from your $pagination array. I believe WordPress catches the paged parameter using the default page parameter. Which is it’s default. Here are the docs for the … Read more

pagination: Only one result is shown even if there are more than one?

Lets clean this up: <h2> <?php $num = $wp_query->post_count; if (have_posts()) :?> <a href=”https://wordpress.stackexchange.com/questions/190595/<?php the_permalink(); ?>”><?php the_title();?></a> <?php endif;?> <?php $search_count = 0; $search = new WP_Query(“s=$s & showposts=5”); if($search->have_posts()) : while($search->have_posts()) : $search->the_post(); $search_count++; endwhile; else : ?> <?php next_posts_link(); ?> <?php previous_posts_link(); ?> <p> there were no results </p> <?php endif;?> </h2> Lets … Read more

Add pagination to the posts retrieved by below query [duplicate]

<?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $news= new WP_Query(array( ‘post_type’=>’post’, ‘posts_per_page’ => 3, ‘paged’ => $paged, )); if($news->have_posts()) : while($news->have_posts()) : $news->the_post(); the_title(); endwhile; $total_pages = $news->max_num_pages; if ($total_pages > 1){ $current_page = max(1, get_query_var(‘paged’)); echo paginate_links(array( ‘base’ => get_pagenum_link(1) . ‘%_%’, ‘format’ => ‘/page/%#%’, ‘current’ => $current_page, ‘total’ => $total_pages, ‘prev_text’ => … Read more

Making a Killer wp_link_pages

Your pagination links are wrapped in with this tag <p class=”pagelinks”> so giving them all the same spacing is easy using CSS like so: .pagelinks a { margin: 0 5px !important; } /* override other defined margins */ maybe you want them all centered on the page too: .pagelinks { display:block; text-align:center; } making the … Read more

foreach pagination

Here is the code I used to solve my problem: <?php $url = $_SERVER[“REQUEST_URI”]; $segments = explode(“https://wordpress.stackexchange.com/”, $url); $page = is_numeric($segments[count($segments)-2]) ? $segments[count($segments)-2] : 1; $next = $page + 1; $prev = $page – 1; $issues_per_page = 11; $lastpage = ceil(wp_count_terms( ‘mag’) / $issues_per_page) ; ?> <?php wp_count_terms( ‘mag’ ); ?> <table> <tr> <?php $col … Read more

How can I remove page slug for all pagings?

Add this code to your functions.php and please re-save your permanent link page and do not forget 301 redirects add_action( ‘init’, ‘remove_page’ ); function remove_page(){ global $wp_rewrite; $wp_rewrite->pagination_base = “”; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)