Showing HTML if Post is In Certain Taxonomy Term

Try using has_term(). Something like this: <?php if( has_term(‘term1’, ‘taxonomy_name’, $post) ) { ?> <img src=”http://www.site.com/wp-content/themes/site/img/stars-01.png” width=”100″ height=”21″ alt=”default”> <?php }elseif ( has_term( ‘term2’, ‘taxonomy_name’, $post) ) { ?> <img src=”http://www.site.com/wp-content/themes/site/img/stars-01.png” width=”100″ height=”21″ alt=”default”> <?php } else { ?> <img src=”http://www.site.com/wp-content/themes/site/img/stars-01.png” width=”100″ height=”21″ alt=”default”> <?php } ?> You may also want to try using shorthand … Read more

pre_get_posts post_meta event

If you have store date different then timestamp it will be VERY hard to do this. To get this if is timestamp stored, you need add “meta_query” like this: add_action(‘pre_get_posts’, ‘my_pre_get_posts’); function my_pre_get_posts($query) { $offest = 0;// you must count this to avoid today and tomorrow $query->set( ‘meta_query’, array( ‘relation’ => ‘AND’, array( ‘key’ => … Read more

Several taxonomy query (like filter)

You would have to add the tax_query parameters depending on if the value is there in the GET parameters. So it would be something like this, $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, ) ); $car = $_GET[“car”]; if(!empty($car)){ array_push( $args[‘tax_query’], array( ‘taxonomy’ => ‘pa_my_taxonomy’, ‘field’ => ‘name’, ‘terms’ => … Read more

Get posts by category name

list all the PAGES that are assigned to particular page(s). I’m assuming you mean “particular term(s).” which would be in your clinical-programs taxonomy. You’ll have to do a bit of coding – you need to start a new WP_Query and structure your query as such: $taxPages = new WP_Query( array( ‘post_type’ => ‘YOUR_POSTTYPE_HERE’, ‘clinical-programs’ => … Read more