How to can I search range of products using between
Perhaps something wrong with your incoming variable? try without $variable. simply with already setted value and check results. ‘value’ => array(100,10000)
Perhaps something wrong with your incoming variable? try without $variable. simply with already setted value and check results. ‘value’ => array(100,10000)
This should not break pagination: add_filter(‘pre_get_posts’, ‘optimized_get_posts’, 100); function optimized_get_posts() { global $wp_query, $wpdb; $wp_query->query_vars[‘no_found_rows’] = 1; $wp_query->found_posts = $wpdb->get_var( “SELECT COUNT(*) FROM wp_posts WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish” OR wp_posts.post_status=”private”)” ); $wp_query->found_posts = apply_filters_ref_array( ‘found_posts’, array( $wp_query->found_posts, &$wp_query ) ); if($wp_query->query_vars[‘posts_per_page’] <= 0) { $wp_query->max_num_pages = 0; } else { $wp_query->max_num_pages = ceil($wp_query->found_posts … Read more
You need to add Category Parameters to your query array. $arguments = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘paged’ => $paged, ‘showposts’ => $postcount, ‘category_name’=> ‘your-category-slug’ );
Just put them between endwhile; and endif;
Your problem is you have: foreach post where A is true, that has a child where B is true Which is actually: foreach post where A is true that has a child where B is true So this is not something you should be doing in 1 query. Instead you would need to do n … Read more
You are passing the cat parameter twice– the second time is empty. $page_query = new WP_Query( ‘post_type=post&cat=145’. ‘&posts_per_page=-1&cat’ . // <– here ‘&orderby=date&order=asc’ ); Maybe it is just me, but I find those query-string-like parameters hard to read and hard to keep straight. I’d advise you to create a proper array. $page_query = new WP_Query( … Read more
I don’t know where $era_opts comes from but a filter on pre_get_posts should do this and preserve your pagination. function era_blog_cats_wpse_103587($qry) { if ($qry->is_page(‘your-page’) && is_main_query()) { $era_opts = get_option(‘era_opts’); // assuming that era_opts are options $blogcats = $era_opts[‘era_opts_blog_thecats’]; if(!empty($era_opts[‘era_opts_blog_thecats’])) { $qry->set(‘category__in’, $blogcats); } } } add_action(‘pre_get_posts’,’era_blog_cats_wpse_103587′); I made several assumptions about your data, but … Read more
Post Filter clearing on pagination $_post
You can’t update the post date with the queries because the update would run repeatedly while the post count equals 6. Every time the query is called the post date would be updated. You can, however, modify the plugin to update the post date when the like button is clicked and the conditions are met. … Read more
Get rid of query_posts() in your template file. Instead, you need to filter the main query object, via pre_get_posts. The following function will exclude the specified category and change posts per page for the main blog posts index: function wpse102566_pre_get_posts( $query ) { if ( is_home() && $query->is_main_query() ) { $query->set( ‘category__not_in’, array( ‘103’ ) … Read more