Ejemplo n.º 1
0
            }
            ?>
             	<?php 
        }
        ?>
			<?php 
    }
    ?>




		    <?php 
    $authorID = get_field("author_1");
    $authorID = $authorID[0]["name"][0]->ID;
    $book = array('post_type' => 'book', 'posts_per_page' => -1, 'meta_query' => $getTadaFunc->getSearch(array("author_1" => $authorID)));
    array_push($book["meta_query"], array("key" => "series", "value" => "SR0", "compare" => "="));
    $book2 = array('post_type' => 'book', 'posts_per_page' => -1, 'meta_query' => $getTadaFunc->getSearch(array("author_1" => $authorID)));
    array_push($book2["meta_query"], array("key" => "series", "value" => "SR0", "compare" => "!="));
    /* The 2nd Query (without global var) */
    $bookList = new WP_Query($book);
    $bookList2 = new WP_Query($book2);
    $arrSeries = array();
    while ($bookList2->have_posts()) {
        $bookList2->the_post();
        array_push($arrSeries, get_field("series", $bookList2->post->ID));
    }
    $arrSeries = array_unique($arrSeries);
    ?>
    
    query_posts($authorMatch);
    while (have_posts()) {
        the_post();
        array_push($arrAuthorMatch, get_the_ID());
    }
    //var_dump($arrAuthorMatch);
}
//var_dump($inc_or_exc);
if (!$paged) {
    $paged = 1;
}
$searchQuery = new tadaFunctions();
if (!$categories && !$age_groups && !$publication_year && !$countries_published_in && !$arrAuthorMatch && !$author_1 && !$illustrator && !$photographer) {
    $published = array('post_type' => 'book', 'posts_per_page' => 20, 's' => $title, 'paged' => $paged);
} else {
    $published = array('post_type' => 'book', 's' => $title, 'posts_per_page' => 20, 'paged' => $paged, 'meta_query' => $searchQuery->getSearch(array("categories" => $categories, "age_groups" => $age_groups, "publication_year" => $publication_year, "author_1" => $author_1, "illustrator" => $illustrator, "photographer" => $photographer, "inc_or_exc" => $inc_or_exc, "countries_published_in" => $countries_published_in, "arrAuthorMatch" => $arrAuthorMatch)));
}
// $published = array(
// 		    'post_type' => 'book',
// 		    'posts_per_page' => 500,
// 		    's' => $title,
// 		  	'paged' => get_query_var( 'paged' ),
// 		  	'meta_query' => array(
// 		  		array("key"=>"author_1_0_name","value"=>"633", "compare" => "LIKE"),
// 		  	)
// );
echo "<pre>";
var_dump($published);
echo "</pre>";
?>