posts_nav_link() not displaying anything

You need to do a little “hack” to get pagination to work for your custom loop. After you define $myquery, do the following: <?php // globalize $wp_query global $wp_query; // copy $wp_query into a temporary variable $temp_wp_query = $wp_query; // nullify $wp_query $wp_query = null; // move $myquery into $wp_query $wp_query = $myquery; ?> At … Read more

How to add pagination with page numbers rather than next/previous links?

It depends on which pagination you’re talking about: Archive Index pagination Single-Post pagination Comments pagination In all three cases, the answer is yes, but the implementation is different. Archive Index Pagination WordPress provides a function, paginate_links(), for post-archive pagination links. It’s use isn’t exactly straightforward, but fortunately, implementation is mostly cut-and-paste from the Codex example. … Read more

Generating rel=prev and rel=next only on wordpress categories

Not entirely sure if I agree with the explanation of your SEO guy as rel=prev and rel=next are used for paginated archives. Of course categories can be one, but also your blog if it’d contain multiple pages. Anyways, here’s what I’m currently using: remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’ ); add_action( ‘wp_head’, ‘cor_rel_next_prev_pagination’ ); /** * Pagination with … Read more

Why do I get `Call to a member function have_posts() on a non-object `? [closed]

Change if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); to if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); Why? When you call $the_query = new WP_Query($query); you’re storing the loop in a variable called $the_query. $query is an array of arguments that you’re passing to the new WP_Query() function. … Read more

Make a custom loop inside single.php with pagination

As I far I know, get_posts() function can not be used to paginated results. It is intended to get an array of posts and it sets no_found_rows to true by default from WP 3.1. Pagination won’t work unless you set it to false, or better, use WP_Query. numberposts is also a invalid argument. $paged = … Read more

How to change the page break numbering?

Put this function in you functions.php – function the_dramatist_wp_link_pages( $args=”” ) { global $page, $numpages, $multipage, $more; $defaults = array( ‘before’ => ‘<p>’ . __( ‘Pages:’ ), ‘after’ => ‘</p>’, ‘link_before’ => ”, ‘link_after’ => ”, ‘next_or_number’ => ‘number’, ‘separator’ => ‘ ‘, ‘nextpagelink’ => __( ‘Next page’ ), ‘previouspagelink’ => __( ‘Previous page’ ), … Read more

Unwanted Duplicate Posts Showing in Pagination Pages

Try with a custom WP_Query to rule out any possible code messing up with your main query pagination. Like this: <?php $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘paged’=> $paged) ); ?> <?php while($query->have_posts()) : … Read more

Blocking author paging for blog entries?

You can send any request for author pages to a 404 with a simple action on parse_query. add_action( ‘parse_query’, ‘_404_author_archives’ ); function _404_author_archives( $qr ) { if( is_author() ) $qr->set_404(); } That should send any requests for an author page to a 404. If you wanted to go a bit further and remove the author … Read more

How to make multiple page out of one post

You can use the WordPress”nextpage” tag: <!–nextpage–> You just drop this into the HTML of your WordPress page wherever you want to break it up. I think your theme must support this tag in order to handle the pagination – on my site I have page “previous/next” links hidden, but most themes probably support this … Read more

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