Tag Info

New answers tagged

1

Before we begin, I must point out the following: You're using a file in your theme to send AJAX requests to, don't do this, there are security implications. Instead, use the WP AJAX API, you'll be able to remove half the code and make it work without having to change the URL everytime your site moves You used query_posts to make your query, this is almost ...


1

You should use WP_Query here, also, for pagination, you need to use the paged parameter, because Wordpress need it to calculate the offset. I guess you could replace both queries with WP_Query, and to avoid showing the first post twice, save the ID in a variable and pass it to the post__not_in parameter in the second query. $paged = ...


0

Before I go to your problem, I would like to start of by asking why you are using a custom query on a category page instead of the main query. You should never change the main query for a custom query on any archive page or on your home page. Wordpress provides an action hook, pre_get_posts which you can use in conjunction with conditional tags to target ...


0

Use WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation on your WordPress site. Link This can be customized with css, if you want to add the plugin as a part of your template, you can do it easily following the directions how to bundle with your theme.


0

Replace all your pagination code with this and change the classes to match your CSS or you could search for the classes included in this code in the Twenty Twelves themes style.css file. <nav class="nav-single"> <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post ...


0

EDIT Referring back to one of your previous questions I've answered, you are using custom taxonomies, so this is most likely your problem then. You then have to set the taxonomy parameter accordingly. See my original answer ORIGINAL ANSWER There are a few things to check here Where is your next_post_link. Did you leave out by default? Are you using ...


0

// This worked great for me so much thanks! I just adapted for what I needed. Right in template file, Sweet! global $wpdb; // QUERY HERE TO COUNT TOTAL RECORDS FOR PAGINATION $total = $wpdb->get_var("SELECT COUNT(*) $post_per_page = 10; $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1; $offset = ( $page * $post_per_page ) - ...


0

The third parameter in your previous_post_link() function call is set to true, which will restrict any results to those posts in the same category as the current post. Try setting the third parameter to false (or remove it entirely), and see if that makes a difference. If the third parameter is intentional, make sure you actually have posts in the same ...


0

The ../page/X structure ties to pagination, not to post names. I'm sure you could change them but I'm not sure how deep the effects of the change would be. Have you thought about an alternate solution? Name each post your chapter name Forward Chapter 1 Chapter 2 Add a plugin that adds previous / next navigation functionality each individual post. ...


0

Remove: 'no_found_rows' => true, from your WP_Query call inside the widget code. Additionally I would suggest to make this change : 'base' => add_query_arg( 'latest_page', '%#%' ), in your paginate_links call, because add_query_arg() will handle if ? or & is used. This should make the pagination work in your widget. Note: I'm almost, ...


1

You will need to duplicate every instance of $wp_query and change it to $the_query. Example global $wp_query, $the_query; /** Stop execution if there's only 1 page */ if( $wp_query->max_num_pages <= 1 || $the_query->max_num_pages <= 1 ) return; EDIT Here is the pagination function that I use. Have no time to code now or to really ...


0

This might not solve your problem, but it will help you in future to create custom queries. Paginating more than one query can get extremely tricky. By default the build in pagination in Wordpress don't have this logic to paginate multiple queries. You will have to run multiple queries and merge them in some way. OK, now to what I would like to point out. ...


0

You could recreate the $loaded array from the database: $hot_ppp = 3; $next_ppp = 3; $recents_ppp = 3; if ( $paged > 1 ) { $prev_hot_next_loaded = $wpdb->get_col( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->posts . ' p JOIN ' . $wpdb->postmeta . ' pm ON pm.post_id = p.ID AND pm.meta_key = %s' . ' WHERE p.post_type = %s AND ...


0

Can you try this? $paged = (get_query_var('page')) ? get_query_var('page') : 1;


0

You have any News page? Check your page list. I think that there have a page which is taking the same category slug.


0

I had the same problem. I was using a form to sort the data, and a pagination using paginate_links. My solution was to use $_SESSIONS to store the $_POST data from the sort (instead of just parsing the $_POST data), and set the form action to get_permalink(). Make sure to unset your session if you are not using pagination or if you are not $_POST ing the ...


0

This should work, but I haven't tested it: global $wp_query; $page = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $ppp = get_query_var('posts_per_page'); $end = $ppp * $page; $start = $end - $ppp + 1; $total = $wp_query->found_posts; echo "Showing posts $start through $end of $total total.";


1

EDIT - ANSWER REVISITED I've being working on another solution which is actually better the original answer. This does not involve any custom query and I think for all purposes my original answer can be dropped but kept for informational purposes I still believe you are on the homepage and will also treat this as such. So this is my new solution STEP 1 ...



Top 50 recent answers are included