Tag Info

New answers tagged

0

The images where setted by woocommerce, In case someone needs, this is how I did it $thumb_id = get_woocommerce_term_meta( $term->term_id, 'thumbnail_id', true ); $term_img = wp_get_attachment_url( $thumb_id );


1

Taxonomies don't by default have thumbnail images. Without knowing how those are set I can't say exactly how to get the thumbnails, but as for "what am I doing wrong?" get_post_thumbnail_id accepts a post ID or lacking that assumes the current post in the Loop. You are passing it a term_id, which isn't going to work. You can see that in the source: 32 ...


0

Then try to add foreach ( $arr_terms as $terms_links ) { if(!empty($terms_links)) { echo '<a href="#">' . $terms_links . '</a>';  } } That checks if the $terms_links is empty, and if so it wont print it out.


0

Try changing the field value to term_id, since there is no id value for that option. Ref: WP_Query Taxonomy Parameters


2

As you had narrowed it down, since your post permalinks include category WP is trying to figure out how to put them together for every post. Object Cache The staple approach would be to optimize efficiency of overall setup, rather than micromanage generations of bits and pieces. If you set up persistent Object Cache for the site, then category information ...


0

Thanks Phil Hoyt, this was exactly what I was looking for. But, alas, I couldn't get it to work with my setup. What does work is the following: <?php // Solution for sorting by ACF custom-field for tracks categories // http://support.advancedcustomfields.com/forums/topic/sorting-categories-list-by-custom-field/ $categories = ...


0

I've got this fixed now. Managed to talk with my old developer and he added this: $termsById = array(); foreach ($terms as $t) { $termsById[$t->term_id] = $t; } I had to add this new variable where $terms was previously used on line 14. Thanks for your help everyone, I appreciate the effort.


1

If you look at the template hierarchy, you need to create a template taxonomy-{$taxonomy}-{$term}.php. In your case, that template will be called taxonomy-product_cat-awesome.php where I assumed the slug of your term is awesome Just a tip, the "categories" of a custom taxonomy is called terms. The build in taxonomy category "categories" is also called ...


0

I updated my question with a partial answer to this problem. By adding an underscore '_' before the name of the meta field it allows you to add meta data without it creating an editable custom field on the page edit screen. update_post_meta( get_queried_object()->ID, '_term_id', $meta_term_id);



Top 50 recent answers are included