Problem when I try to insert pagination

Thanks for @PieterGoosen for his help, I found the solution for my problem. In my functions.php, I construct the next function: function mod_query($query){ if ( !is_admin() && $query->is_main_query() && $query->is_category(‘6’)){ //My Category ID $query->set(‘posts_per_page’,2); } } add_action(‘pre_get_posts’,’mod_query’); And I needed one file, category-blog.php where I build my html code and use the php code if … Read more

next_posts_link(); & previous_posts_link(); not working properly

I did this and its working as expected. Please close this question <div class=”post-content”> <?php // set the “paged” parameter (use ‘page’ if the query is on a static front page) $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $the_query = new WP_Query( ‘posts_per_page=5&post_type=blog&paged=’ . $paged ); if($the_query->have_posts()) { while($the_query->have_posts()) … Read more

Conditional pagination li’s

Yes, but it is really more PHP than WordPress. You just need to reorder things and add some logic: $next = get_next_posts_link( ‘Previous’, $the_query->max_num_pages ); $previous = get_previous_posts_link( ‘Next’ ); if(!empty($next)) { $links[] = ‘<li class=”next”>’.$next.'</li>’; } if(!empty($previous)) { $links[] = ‘<li class=”previous”>’.$previous.'</li>’; } if (!empty($links)) { ?> <nav class=”post-nav clear clearfix”> <ul><?php echo implode($links); … Read more

Pagination, query more pages at once

offset would skip posts, it sounds like you want the current page number * the number of posts per page- $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $posts_per_page = $paged * get_option(‘posts_per_page’); $args = array( ‘posts_per_page’ => $posts_per_page ); You’ll need to keep in mind that total number of pages in the query object will … Read more

remove $_GET-parameter from WP_List_Table::tablenav

You should consider the POST request method for your action. Otherwise you might try to hijack the set_url_scheme filter with: add_filter( ‘set_url_scheme’, ‘wpse_remove_arg’ ); function wpse_remove_arg( $url ) { return remove_query_arg( ‘do_action_xyz’, $url ); } Then you could try to narrow the scope and only run this on the corresponding table page. Further you could … Read more

Translating a pager string

You are doing it wrong You should translate the HTML string, not the function When passing strings into functions, like what you are doing, you should use __() which returns the translated string. _e() would echo the string and you would get the raw text and the modified text on output Example of correct usage: … Read more

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