Tag Info

New answers tagged


Use the Switch statement. switch ($term->name) { case 'customtermincustomtaxonomy': // ... break; case 'anotherterm': // ... break; case 'somethingelse': // ... break; }


The problem is you are getting term_id as a string so convert it before function get_term_link($series); (int)$term_id=(int)str_replace(' ', '',$data[0]->term_id);


Inside the loop you can make use of wp_get_post_terms() to return all the terms associated with the specific post. This object returned holds all the terms with all the properties of the specified terms With that in mind, you can use a foreach loop to get each term, and then check each term's parent. For grandchild terms you will need to do some extra ...


There's no need for two loops. Just iterate over the terms and use in_array(): foreach ( $terms as $term ) { if ( in_array( $term->slug, $months ) { echo 'yes'; else echo 'no'; } }

Top 50 recent answers are included