Taxonomy archive link from term id
you need a semicolon at the end of your last line of code: echo $term_link;
you need a semicolon at the end of your last line of code: echo $term_link;
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
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’ );
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
Turns out there was a function hooking the filter list_terms_exclusions, and the return was inside a logically faulty conditional. I fixed it and now the term query exclusion works as intended.
Change operator to: if($term->term_id === 4 ): Check this for more: https://stackoverflow.com/a/80649/12785113
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
You are overwriting $product_cat_slugs on every iteration of your loop – so when it’s finished, that variable will be set to the last value. Why not do all of your outputs inside that loop? Or if for some reason you don’t want to do that, make $product_cat_slugs an array instead of a variable: $product_cat_slugs = … Read more
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
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