Pagination problem with multiple loops on the same page
you might wanna try wp_reset_query(); at the end of your loops
you might wanna try wp_reset_query(); at the end of your loops
My issue was with nginx, specifically: location / { index index.php index.html; try_files $uri $uri/ /index.php; } Which I changed try_files $uri $uri/ /index.php; to try_files $uri $uri/ /index.php?$args; as outlined here which also fixed another issue that I was having with URL parameters.
As I said, I was just missing the declaration to use the global $wp_query, so it wasn’t accessing my filters. Here’s what worked incase it helps: global $wp_query; // pull variable from url if (isset($wp_query->query_vars[‘country’])) { $this->user_country = $wp_query->query_vars[‘country’]; } else { $this->user_country = ‘your country’; } if (isset($wp_query->query_vars[‘lat’])) { $this->user_lat = $wp_query->query_vars[‘lat’]; } else … Read more
How about something like this where you filter the posts once the WP_Query gets them?
query_posts() is just a wrapper for WP_Query that sets the $wp_query global.
If I understand your question correctly, you try to just get the children and ignore the parent. Dont know where post_child => 0 comes from but I’d use post_parent => $parent_id instead. In that case you have to catch the parent ID before you do any new queries. If you do something like this at … Read more
Because you’re calling get_post_permalink etc, I think you may need to add wp_reset_postdata(); as well, per this section in the codex: http://codex.wordpress.org/Class_Reference/WP_Query#Interacting_with_WP_Query Hope this helps, best of luck!
I would suggest storing the date-times as either: Timestamp (to sort/compare by meta_value_num) ‘yyyy-mm-dd hh:mm (e.g. 2012-04-11 19:37) to sort/compare by meta_value Then the following will work (assuming you’re using timestamp): $now = current_time(‘timestamp’); $args = array( ‘post_type’ => ‘rides’, ‘posts_per_page’ => 3, ‘meta_query’ => array( array( ‘key’ => ‘date’, ‘value’ => $now, ‘compare’ => … Read more
Where you do your pagination, you can use something like if( $page != 1 ). This allows you you to output certain sections on only the first page. You will need to change $page to your pagination variable, but that is trivial.
the_title(), the_excerpt() and the_permalink() prints the output at once but the shortcode function is supposed to just return the output. You can use get_the_title(), get_permalink() and get_the_excerpt() instead.