Taxonomy filter under Polylang
I got it. With help from this answer: get all posts ID from a category $post_type_ids = get_posts(array( ‘numberposts’ => -1, // get all posts. ‘post_type’ => ‘texto’, ‘fields’ => ‘ids’, // Only get post IDs ));
I got it. With help from this answer: get all posts ID from a category $post_type_ids = get_posts(array( ‘numberposts’ => -1, // get all posts. ‘post_type’ => ‘texto’, ‘fields’ => ‘ids’, // Only get post IDs ));
While custom SQL is sometimes what it takes, note that to address your concern for WP_Query it supports ‘fields’ => ‘ids’ argument to limit data returned to IDs (which can be easily used for count). In many cases that is reasonably efficient while more robust and future-proof in WP environment.
Try using a meta_query in your $args. You are far more flexible this way. For the full reference of the possibilities check the Codex $args = array( ‘post_type’ => ‘Product’, ‘posts_per_page’ => -1, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘product_type’, ‘value’ => ‘Paper’, ‘compare’ => ‘=’, ) ) );
First, this is confusing: $result = $newdb->get_results(“SELECT “.$column1.”,”.$column2.” FROM members”); $columnq = $newdb->get_results(“SELECT “.$column1.” FROM members”); $columnq2 = $newdb->get_results(“SELECT “.$column2.” FROM members”); You should only need the first of those or the last two (with one alteration). Secondly, get_results will return an array or an object (default), so using it as you do here isn’t … Read more
First, don’t use query_posts(). Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. http://codex.wordpress.org/Function_Reference/query_posts The … Read more
By default hide_empty is true for get_terms. So i guess you must be missing terms which do not have posts. Try this, <?php $terms = get_terms(“autorzy”, array(‘orderby’ => ‘count’, ‘order’ => ‘DESC’,’hide_empty’=>0 )); $count = count($terms); if ( $count > 0 ){ echo “<div>”; foreach ( $terms as $term ) { ?> <?php echo $term->name; … Read more
I think you may need to add global $post after the loop starts based on a similar question found here. <?php while ($queryObject->have_posts()) { $queryObject->the_post(); global $post; ?> I wish I could explain more about why, but I didn’t have time to investigate further.
You can use the parse_query action hook, and set the orderby and order paramenters. function my_mod_search($query) { if ($query->is_search()) { $query->query_vars[‘order’] = ‘ASC’; $query->query_vars[‘orderby’] = ‘post_date’; } } add_action(‘parse_query’, ‘my_mod_search’);
I found that the answer was not found in my query, as it is correct. I was not passing variables to the query properly. From my research, there is no constraint on the number of custom meta queries you can place in one query.
You can use posts_per_page to return all post from the database Just little modification in your WP query <?php $query = new WP_Query(array(‘post_type’ => ‘any’,’posts_per_page’=>-1)); ?> Try with this modification if it works for you.