Skip to content

Commit

Permalink
Merge pull request #90 from marcovisona/master
Browse files Browse the repository at this point in the history
query by current post taxonomy terms, props @marcovisona
  • Loading branch information
billerickson committed Apr 17, 2015
2 parents bd28585 + 6c933d4 commit 6a088db
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions display-posts-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,17 @@ function be_display_posts_shortcode( $atts ) {
// If taxonomy attributes, create a taxonomy query
if ( !empty( $taxonomy ) && !empty( $tax_term ) ) {

// Term string to array
$tax_term = explode( ', ', $tax_term );
if( 'current' == $tax_term ) {
global $post;
$terms = wp_get_post_terms(get_the_ID(), $taxonomy);
$tax_term = array();
foreach ($terms as $term) {
$tax_term[] = $term->slug;
}
}else{
// Term string to array
$tax_term = explode( ', ', $tax_term );
}

// Validate operator
if( !in_array( $tax_operator, array( 'IN', 'NOT IN', 'AND' ) ) )
Expand Down

0 comments on commit 6a088db

Please sign in to comment.