Adding tag’s featured image to tag archive
Adding tag’s featured image to tag archive
Adding tag’s featured image to tag archive
get_the_terms() is the function you need to get terms of a custom taxonomy associated to your post. It is similar (but not identical) to get_the_category() for the default category taxonomy. [Edited to answer the first comment below] Adapting the code you have for categories, here’s how you can display either categories or terms: <?php $categories … Read more
You might be able to use the the_author_posts_link filter to do this: add_filter( ‘the_author_posts_link’, functoin ($link) { global $post_id; // get “source” tax terms $sources = get_the_terms( $post_id, ‘source’ ); // build html $html=””; foreach ($sources as $source) { $html += ‘<a href=”‘. get_term_link($source) .'”>’. $source->name .'</a>’; } // pre-pend html to author link $link … Read more
My bad – the mark up for the edit page is different than add. Used this instead add_action(‘provider_edit_form_fields’, array($this, ‘category_metabox_edit’), 10, 1); // add image field in edit form function category_metabox_edit($tag) { $term_val = get_term_meta($tag->term_id, ‘show_on_provider’, true); $term_val == 1 ? $checked = ‘checked’ : $checked = ”; echo ‘<tr class=”form-field”> <th scope=”row” valign=”top”><label for=”show_on_provider”>’ … Read more
If you want to display in archive or category (taxonomy) template, try this: $artist_nickname = get_term_meta( get_queried_object_id(), ‘artist_nickname’, true); echo $artist_nickname;
Over at Google+ I posted the same question and credits go to Alexander Conroy for coding up the correct solution: /* List all blogs, source example 2: http://codex.wordpress.org/Function_Reference/get_terms#Examples * * credits Alexander Conroy – https://plus.google.com/u/0/113053085239726972447 */ $terms = get_terms(‘blog’, $args); $blog_image_meta = get_option(‘blog_image’); if (!empty($terms)) { foreach ($terms as $term) { $meta = isset($blog_image_meta[$term->term_id]) ? … Read more
I managed to work it out. Seems like the filters only work when wrapped in an ‘admin_init’ action. My final code to add an admin column for the custom taxonomy meta ‘front_page’ to the custom taxonomy ‘shopp_department’ in my themes’ functions.php // Register the column function department_add_dynamic_hooks() { $taxonomy = ‘shopp_department’; add_filter( ‘manage_’ . $taxonomy … Read more