Is there a way I can return terms by name using a shortcode?

This is the solution to get post terms by taxonomy by shortcode: /** * Custom shortcode to get terms */ function ALC_post_terms_by_taxonomy( $atts ) { global $post; $taxonomyTerms = wp_get_post_terms( $post->ID, $atts[‘taxonomy’], ‘orderby=name&hide_empty=0’ ); $term_array = array(); foreach ($taxonomyTerms as $taxonomyTerm) { $term_array[] = $taxonomyTerm->name; } return implode( ‘, ‘, $term_array ); } add_shortcode(‘get_terms_by_taxonomy’, ‘ALC_post_terms_by_taxonomy’); … Read more

Navigation links to posts in current term shortcode

Have you tried to echo get_previous_post_link as this is what is called when you set function previous_post_link. function fivehats_previous_post() { // You need to echo it out for it to display in the page echo get_previous_post_link( ‘%link’, ‘%title’, TRUE, ‘ ‘, ‘property-category’ ); } add_shortcode( ‘fh_prev’, ‘fivehats_previous_post’ );

$term->taxonomy stripping out underscores

WordPress sees underscore names as relating to post types and dashes as relating to taxonomies. Perhaps this has something to do with it? Also, have you flushed your permalinks recently (change the permalink structure to something else and then back)? It might be stuck in your database with the “sanitized” taxonomy name. This has happened … Read more

How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query

while ( $loop->have_posts() ) : $loop->the_post(); //Edit Width post type $categories = get_the_terms(get_the_ID(), ‘services’); $separator=”, “; if ( ! empty( $categories ) ) { foreach( $categories as $category ) { echo ‘<a class=”cat_item” href=”‘ . esc_url( get_category_link( $category->term_id ) ) . ‘” alt=”‘ . esc_attr( sprintf( __( ‘%s’, ‘your-themes’ ), $category->name ) ) . ‘”>’ … Read more

How to create a list of terms who’s posts also have a predefined external term?

if i understand correctly you want to get a list of albums (posts) of a specific artist(taxonomy) and that are have ihaveit term. if so the its a simple query using tax_query: $args = array( ‘posts_per_page’ => -1, //get all ‘post_type’ => ‘album’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘artist’, ‘field’ => … Read more

show 10 most recent custom post types excluding the one(s) from specific custom taxonomy

Firstly, your tax query is a little jumbled. The first nested array should actually be at the ‘root’ of your query_posts() argument, with tax_query as a key among them; array( ‘post_type’ => ‘review’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 10, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘reviewcats’, ‘terms’ => array( ‘featured’ ), ‘field’ … Read more