We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support How to get the template part working with WPSP? Reply To: How to get the template part working with WPSP?

#5538
Alberto
Participant

Hi Tom!
Yes, I’m filtering all the posts looking for the ones that have both those taxonomies and both those terms, so it should only show 1 post (the one matching that criteria)
With the custom query only worked filtering by gender or by age, not both.
This is the var_exports output:

WP_Query::__set_state(array(
   'query' => 
  array (
    'order' => 'desc',
    'orderby' => 'date',
    'post_type' => 'locuciones',
    'posts_per_page' => 12,
    'paged' => 0,
    'post_status' => 
    array (
      0 => 'publish',
    ),
  ),
   'query_vars' => 
  array (
    'order' => 'DESC',
    'orderby' => 'date',
    'post_type' => 'locuciones',
    'posts_per_page' => 12,
    'paged' => 0,
    'post_status' => 
    array (
      0 => 'publish',
    ),
    'error' => '',
    'm' => '',
    'p' => 0,
    'post_parent' => '',
    'subpost' => '',
    'subpost_id' => '',
    'attachment' => '',
    'attachment_id' => 0,
    'name' => '',
    'static' => '',
    'pagename' => '',
    'page_id' => 0,
    'second' => '',
    'minute' => '',
    'hour' => '',
    'day' => 0,
    'monthnum' => 0,
    'year' => 0,
    'w' => 0,
    'category_name' => '',
    'tag' => '',
    'cat' => '',
    'tag_id' => '',
    'author' => '',
    'author_name' => '',
    'feed' => '',
    'tb' => '',
    'meta_key' => '',
    'meta_value' => '',
    'preview' => '',
    's' => '',
    'sentence' => '',
    'title' => '',
    'fields' => '',
    'menu_order' => '',
    'embed' => '',
    'category__in' => 
    array (
    ),
    'category__not_in' => 
    array (
    ),
    'category__and' => 
    array (
    ),
    'post__in' => 
    array (
    ),
    'post__not_in' => 
    array (
    ),
    'post_name__in' => 
    array (
    ),
    'tag__in' => 
    array (
    ),
    'tag__not_in' => 
    array (
    ),
    'tag__and' => 
    array (
    ),
    'tag_slug__in' => 
    array (
    ),
    'tag_slug__and' => 
    array (
    ),
    'post_parent__in' => 
    array (
    ),
    'post_parent__not_in' => 
    array (
    ),
    'author__in' => 
    array (
    ),
    'author__not_in' => 
    array (
    ),
    'ignore_sticky_posts' => false,
    'suppress_filters' => false,
    'cache_results' => true,
    'update_post_term_cache' => true,
    'lazy_load_term_meta' => true,
    'update_post_meta_cache' => true,
    'nopaging' => false,
    'comments_per_page' => '50',
    'no_found_rows' => false,
  ),
   'tax_query' => 
  WP_Tax_Query::__set_state(array(
     'queries' => 
    array (
    ),
     'relation' => 'AND',
     'table_aliases' => 
    array (
    ),
     'queried_terms' => 
    array (
    ),
     'primary_table' => 'ch1n0_posts',
     'primary_id_column' => 'ID',
  )),
   'meta_query' => 
  WP_Meta_Query::__set_state(array(
     'queries' => 
    array (
    ),
     'relation' => NULL,
     'meta_table' => NULL,
     'meta_id_column' => NULL,
     'primary_table' => NULL,
     'primary_id_column' => NULL,
     'table_aliases' => 
    array (
    ),
     'clauses' => 
    array (
    ),
     'has_or_relation' => false,
  )),
   'date_query' => false,
   'request' => 'SELECT SQL_CALC_FOUND_ROWS  ch1n0_posts.ID FROM ch1n0_posts  WHERE 1=1  AND ch1n0_posts.post_type = \'locuciones\' AND ((ch1n0_posts.post_status = \'publish\'))  ORDER BY ch1n0_posts.post_date DESC LIMIT 0, 12',
   'posts' => 
  array (
    0 => 
    WP_Post::__set_state(array(...

and so on till 11, then:

'post_count' => 12,
   'current_post' => -1,
   'in_the_loop' => false,
   'post' => 
  WP_Post::__set_state(array(
     'ID' => 559,
     'post_author' => '3',
     'post_date' => '2017-07-08 19:25:51',
     'post_date_gmt' => '2017-07-08 19:25:51',
     'post_content' => 'La locución en chino que mostramos a continuación es un ejemplo de introducción histórica narrada por una voz masculina.

历史介绍
[audio mp3="http://traduccioneschino.es/wp-content/uploads/2017/07/Locutor-varon-chino-29.mp3"][/audio]',
     'post_title' => 'Recorrido museo del Prado',
     'post_excerpt' => '',
     'post_status' => 'publish',
     'comment_status' => 'closed',
     'ping_status' => 'closed',
     'post_password' => '',
     'post_name' => 'chino-nativo-demostracion-hombre',
     'to_ping' => '',
     'pinged' => '',
     'post_modified' => '2018-06-28 09:49:06',
     'post_modified_gmt' => '2018-06-28 09:49:06',
     'post_content_filtered' => '',
     'post_parent' => 0,
     'guid' => 'http://traduccioneschino.es/?post_type=locuciones&p=559',
     'menu_order' => 0,
     'post_type' => 'locuciones',
     'post_mime_type' => '',
     'comment_count' => '0',
     'filter' => 'raw',
  )),
   'comment_count' => 0,
   'current_comment' => -1,
   'found_posts' => '38',
   'max_num_pages' => 4.0,
   'max_num_comment_pages' => 0,
   'is_single' => false,
   'is_preview' => false,
   'is_page' => false,
   'is_archive' => true,
   'is_date' => false,
   'is_year' => false,
   'is_month' => false,
   'is_day' => false,
   'is_time' => false,
   'is_author' => false,
   'is_category' => false,
   'is_tag' => false,
   'is_tax' => false,
   'is_search' => false,
   'is_feed' => false,
   'is_comment_feed' => false,
   'is_trackback' => false,
   'is_home' => false,
   'is_404' => false,
   'is_embed' => false,
   'is_paged' => false,
   'is_admin' => false,
   'is_attachment' => false,
   'is_singular' => false,
   'is_robots' => false,
   'is_posts_page' => false,
   'is_post_type_archive' => true,
   'query_vars_hash' => '6406e4db5ba12f5dc1e253aec2e5e334',
   'query_vars_changed' => false,
   'thumbnails_cached' => false,
   'stopwords' => NULL,
   'compat_fields' => 
  array (
    0 => 'query_vars_hash',
    1 => 'query_vars_changed',
  ),
   'compat_methods' => 
  array (
    0 => 'init_query_flags',
    1 => 'parse_tax_query',
  ),
))

Hope it helps…
Thanks!