pagination with sticky posts

I’d suggest using two queries, one for sticky posts, another for all the others. First: query_posts(array(‘post__in’ => get_option(‘sticky_posts’), posts_per_page => 1)); then query all the other posts query_posts( array( ‘post__not_in’ => get_option( ‘sticky_posts’ ), posts_per_page => 7, orderby => date, paged => ‘.$page_to_load.’)); this should do it.

How to implement pagination in backward way eg. first – 20 – 19 – 18 – … – 3 – 2 – 1 – last

You could use wp_paginate_links(), pass it the ‘type’ => ‘array’ parameter in the argument array, and then array_reverse() the output. But: if you’re doing this for SEO purposes, don’t bother. Your canonical URL should be your single-post view, not an archive index; so the index archive page numbers should have minimal SEO impact, no matter … Read more

5 posts per page from single category, paginated

Are you writing a custom query? If so, are you using the paged function in your query? It would look something like this: <?php query_posts( array( ‘posts_per_page’ => 5, ‘cat’ => ’10’, ‘paged’ => ( get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1 ), ) ); while( $new_query->have_posts() ) : $new_query->the_post(); ?> // loop … Read more

A way to detect which page a post is on

Alright, nevermind. I got this solved by doing this at the top of the single post template: $position_query = array( ‘post_type’ => ‘portfolio’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘numberposts’ => -1 ); $position_posts = get_posts($position_query); $count = 0; foreach ($position_posts as $position_post) { $count++; if ($position_post->ID == $current_id) { $position = $count; break; } … Read more

Paginated HTML Sitemap

Haven’t tested this, but here you go, lemmie know how it works. You’ll needa do your own pagination links, but that should be pretty straightforward //pagination $offset=”0″; $no_of_posts = the_posts_per_page( false ); //Number of posts to display on each page if (preg_match( ‘/page/’, $_SERVER[‘REQUEST_URI’] ) ) { $uri = explode( “https://wordpress.stackexchange.com/”, $_SERVER[‘REQUEST_URI’] ); foreach ( … Read more

How WordPress converts URL to $query_string

Check out WP::parse_request() – unfortunately, it was never really designed for public use. You could try this, not sure of the repercussions: global $wp, $wp_the_query; // Grab the request_uri component of the referer URL. if ( ! $url = parse_url( $_GET[‘my_referer_parameter’] ) ) return ‘Oh dear, poorly formed referer.’; // Ewww! Trick WP::parse_request by spoofing … Read more

Pagination on custom query

Add this to your query: ‘paged’ => get_query_var(‘paged’) Like so: $args = array( ‘post_type’ => ‘species’, ‘meta_query’ => $meta_query, ‘tax_query’ => $tax_query, ‘paged’ => get_query_var(‘paged’) ); Should do the trick.. Using Wp-pageNavi? dont forget to add the wp-pagenavi tag just after the loop ends <div class=”navigation”><?php wp_pagenavi(); ?></div> . Hope This Helps 😉 Cheers, Sagive.

Pagination in a Shortcode. Get_next_posts_link not working but get_previous_posts_link works fine right next to it

This is an old question, but I needed the answer to this one as well. Here is the solution taken right from the WP codex… $prev = ‘<div class=”nav-previous”>’ . get_next_posts_link( __( ‘<span class=”meta-nav”>&larr;</span> Previous’ ), $loop->max_num_pages ); You need to append the max_num_pages parameter from the query to your output and it should work … Read more

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