Broken pagination links on WP 4.9.10 blog pages
please go to setting > permalinks and click on the save button if you are using nginx reverse proxy check this page: https://codex.wordpress.org/Nginx
please go to setting > permalinks and click on the save button if you are using nginx reverse proxy check this page: https://codex.wordpress.org/Nginx
I got it with this script! from: https://stackoverflow.com/questions/13362026/wordpress-pagination-adding-an-anchor-link <script type=”text/javascript”> $(document).ready(function() { $(‘.pagenavi a’).each(function(i,a){$(a).attr(‘href’,$(a).attr(‘href’)+’#blog’)}); }); </script>
You’re using previous_posts_link (and next_posts_link) function in your code. This function prints a link to the previous set of posts within the current query. So they are meant for posts archives. But if you’re on single page/post, so there is only one post in the query – the one that is shown. So these links … Read more
You’ll have a much easier time if you use the main query, and add your extra filters with pre_get_posts. So first of all, just use search.php as your template, and use the main query. So no new WP_Query(), and use the have_posts() and the_post() functions, not the methods. So your template (simplified) would be like … Read more
If you want to show only 5 posts you should set posts_per_page to 5. And by setting paged parameter to any number you want, you can query posts in a specific page. For example if you want to get posts 6 to 10 you should do: $args = array( ‘post_type’ => ‘project’, ‘posts_per_page’ => 5, … Read more
It’s not possible. paginate_links() is hard-coded to stop producing output as soon as it notices that there’ll be less than 2 pages. You can see this on lines 4130–4132 of the function’s source code here: https://developer.wordpress.org/reference/functions/paginate_links/#source The only workaround would be to copy the code of paginate_links() into your own new function and change the … Read more
I use this on archive pages. If you are trying to use it elsewhere then that might be a cause of the issue. if ( ! function_exists( ‘_s_pagination_links’ ) ) : /** * Numbered pagination */ function _s_pagination_links() { global $wp_query; $total_pages = $wp_query->max_num_pages; if ($total_pages > 1){ $current_page = max(1, get_query_var(‘paged’)); echo paginate_links(array( ‘base’ … Read more
How to add pagination in Terms
Found the solution. Is anybody facing the same please check this. My code is right, but because of the offset parameter pagination is not working. I found the solution here. So, this is my final code: <?php $paged = ( get_query_var(‘page’) ) ? get_query_var(‘page’) : 1; $per_page = 10; $defualt_offset = $offset; if ($paged == … Read more
Answered in a comment: try first with using a priority of 11 or greater, e.g. add_action( ‘pre_get_posts’, ‘custom_archive_items’, 20 );