How to display paginated posts from all categories?

A basic WP_Query instance and loop will work (untested): $posts = new WP_Query( array( ‘paged’ => get_query_var( ‘paged’, 1 ), ) ); while ( $posts->have_posts() ) { $posts->the_post(); … } $current_page = 1; if ( isset( $_GET[‘paged’] ) ) { $current_page = absint( $_GET[‘paged’] ); } echo paginate_links( array( ‘base’ => add_query_arg( ‘paged’, ‘%#%’ ), … Read more

Pagination with WP_query giving same items in each page

After digging for sometime I’ve managed to solve it. The issue was I wasn’t passing paged variable in the args. After passing it and tweaking the pagination logic it is working now. <?php $data = getData(); if(!empty($_REQUEST[‘posts’])){ $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 15, ‘category_name’ => $_REQUEST[‘posts’], ‘paged’ => $paged … Read more

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