[php]
<?php
$term = get_term_by( 'slug', get_query_var( 'tag' ), "post_tag" );
$tagslug = $term->slug;
$post_types = get_post_types('','names');
?>
<?php
//first query
$blogposts = get_posts(array(
'tag' => $tagslug, //first taxonomy
'post_type' => $post_types,
'post_status' => 'publish',
));
//second query
$authorposts = get_posts(array(
'bookauthor' => $tagslug, //second taxonomy
'post_type' => $post_types,
'post_status' => 'publish',
));
$mergedposts = array_merge( $blogposts, $authorposts ); //combine queries
$postids = array();
foreach( $mergedposts as $item ) {
$postids[]=$item->ID; //create a new query only of the post ids
}
$uniqueposts = array_unique($postids); //remove duplicate post ids
$posts = get_posts(array(
'post__in' => $uniqueposts, //new query of only the unique post ids on the merged queries from above
'post_type' => $post_types,
'post_status' => 'publish',
));
foreach( $posts as $post ) :
setup_postdata($post);
?>
[/php]Revisions
- October 18, 2013 @ 00:15:37 [Current Revision] by PeterLugg
- October 18, 2013 @ 00:15:37 by PeterLugg
- July 2, 2013 @ 12:12:26 by PeterLugg
- July 2, 2013 @ 12:11:19 by PeterLugg
Revision Differences
There are no differences between the October 18, 2013 @ 00:15:37 revision and the current revision. (Maybe only post meta information was changed.)
No comments yet.