Add pagination to this following template

Firstly, you have 2 queries, the second is overriding the first: <?php query_posts($query_string . ‘&pagename=&page_id=’); ?> <?php query_posts(‘posts_per_page=3’); ?> Replace them with a single query: <?php query_posts($query_string . ‘&pagename=&page_id=&posts_per_page=3’); ?> Then modify your query as such: ‘paged’ => ( get_query_var(‘paged’) ? get_query_var(‘paged’) : 1 ) e.g. <?php query_posts($query_string . ‘&pagename=&page_id=&posts_per_page=3&page=”.( get_query_var(“paged’) ? get_query_var(‘paged’) : 1 … Read more

Page not found yet the posts are listed?

It’s not correct solving of issue and it’s not a bug. Here is explanation why it happens: “Pagination is calculated before you get to the template file that runs query_posts. The proper way to alter posts_per_page conditionally is to use the pre_get_posts hook to modify the main query.” https://wordpress.stackexchange.com/a/42063/17177 I found one implementation “pre_get_posts” that … Read more

paginate posts on admin page

This is what ended up solving it (I’ll include the relevant parts) $total = wp_count_posts()->publish; $perpage = 10; $curpage = isset( $_GET[‘pagenum’] ) ? intval($_GET[‘pagenum’]) : 1; global $post; $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘posts_per_page’ => $perpage, ‘offset’ => $perpage*($curpage-1) ); $pages = ceil($total/$perpage); $dash_posts … Read more

Can I paginate this get_attachment query?

Yup. You’ll need to get/set $paged with your query, like so: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘numberposts’ => 15, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $post->ID, ‘paged’ => $paged ); ?> <?php $photos = new WP_Query($args); ?> <?php if ( $photos->have_posts() … Read more

Pagination in author, category, archive and tags pages does not work

This looks like a simular issue to this one with wp-pageNavi: http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html. Taxonomies and archives should use ‘page’, not ‘paged’ so use that in the urls to begin with. Then, to ensure your pagination script works in all locations you can change the way you get your $paged variable. Something like this should do it: … Read more

Adding paging to get_posts()

If you make paged equal to get_query_var( ‘paged’ ) that should do the trick. You may need to do something like $paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1; and then set paged to $paged.

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