Salve,
ho questo codice su wordpress che mi filtra dei risultati.
codice:
<div id="primary" class="site-content">
<div id="content" role="main">
<?php
$gallery_cats = get_ds_option('album_cats_gallery_page');
if($gallery_cats) {
$tax_query = array(
'relation' => 'AND',
array(
'taxonomy' => 'ds-gallery-category',
'field' => 'slug',
'terms' => preg_split("/\s*,\s*/", $gallery_cats),
'include_children' => true,
'operator' => 'IN'
)
);
} else {
$tax_query = '';
}
$loop = new WP_Query( array(
'post_type' => 'ds-gallery',
'posts_per_page' => -1,
'tax_query' => $tax_query
));
?>
Mi filtra tutti i post_type "ds-gallery", io vorrei che mi filtrasse anche per categoria ho provato in tutti i modi e in tutte le maniere senza risultato...
alla fine ho trovato la scappatoia con
codice:
$loop = new WP_Query( array(
'author' => '2',
'post_type' => 'ds-gallery',
cioè quando voglio inserire dei post in quella categoria li pubblichero dall'account 2. E' una boiata tremenda ma non sono riuscito a settargli una categoria.
L'id categoria è 9 il name category è video.
Non so....
Mi potete aiutare?
Grazie