Pagination on with query_posts in custom post type template

@Milo Thanks, the pre_get-posts seems to work perfectly. I was missing that before, thought my choices were between wp_query and query_posts. The below should ONLY alter the query on the “rg_blog” custom post type archive, right? function blog_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_post_type_archive(‘rg_blog’)) { $query->set(‘post_type’, ‘post’); } } } add_action(‘pre_get_posts’,’blog_filter’);

WP_Query Pagination on multiple-loop page breaks WP or doesn’t show up

Why can’t you write custom pagination? function theme_get_next_posts_link($query, $label = null, $max_page = 0) { global $paged; if(!$max_page) $max_page = $query->max_num_pages; if(!$paged) $paged = 1; $nextpage = intval($paged) + 1; if(null === $label) $label = “Older Posts”; if(!is_single() && $nextpage <= $max_page): $attr = apply_filters( ‘next_posts_link_attributes’, ” ); echo ‘<a class=”page-l” href=”‘ . next_posts( $max_page, … Read more

Prev and Next link for splitting single post into multiple pages [duplicate]

Check out the wp_link_pages function <?php $args = array( ‘before’ => ‘<p>’ . __(‘Pages:’), ‘after’ => ‘</p>’, ‘link_before’ => ”, ‘link_after’ => ”, ‘next_or_number’ => ‘number’, ‘nextpagelink’ => __(‘Next page’), ‘previouspagelink’ => __(‘Previous page’), ‘pagelink’ => ‘%’, ‘echo’ => 1 ); wp_link_pages( $args ); ?>

Pull Random Attachments With Pagination

Your since83_pagination() function is assuming the main query– $wp_query— but you are needing to paginate something very different. You need to be paginating the results in $attachments which you are retrieving with get_children(). That was my guess as soon as I saw this question. You are going to need to rethink this. There are two … Read more

Fetching more posts in WordPress via AJAX

I ended up modifying the archive.php file to serve different content when requested normally and via ajax. if ((isset($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’)) { $response = array(); $response[‘posts’] = ”; if (have_posts()) { ob_start(); while (have_posts()) { the_post(); get_template_part(‘content’); } $response[‘posts’] .= ob_get_clean(); } else { //no posts $response[‘posts’] .= ‘nothing’; } echo json_encode($response); } … Read more

Pass additional parameter in the URL

There is a wordpress function for adding $_GET-Params to an URL: add_query_arg(). It works like this: $link = add_query_arg( array(‘pagenum’ => $your_page_number) ); By default it adds the param to the current page (gets content from $_SERVER[REQUEST_URI]) but you can also pass an optional param to the function if you want the link to go … Read more

Tabbed content with Pagination

Ok solved, I managed to run a query for each post as a WP_Query instead as Brasofilo pointed out. Then built in the custom pagination via wordpresses help rather than WP_navi as this would not split into sections on one page. As Follows is my new query :- <?php $cat_id = get_query_var(‘cat’); $limit = get_option(‘posts_per_page’); … Read more

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