How to display WooCommerce category image in my category page banner as a background?

get_post_thumbnail return featured image for post. in order to get a thumbnail of the category, you need to fetch it through term meta. global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_term_meta( $cat->term_id, ‘thumbnail_id’, true ); $image = wp_get_attachment_url( $thumbnail_id ); on the product page, since there can be multiple terms for a single product, you … Read more

Display term picture of each post in a loop

So, I finally found the solution. Maybe there are better ways to arrive to the same result, but at least, it works. Here it goes: <?php $terms = get_the_terms( $post->ID , ‘issues’ ); foreach ($terms as $key) : $size = “article-small”; $image_id = get_field(“image_tag”, $key, false); $image = wp_get_attachment_image_src($image_id, $size); ?> <img src=”<?php echo $image[0]; … Read more

How to add Support to show Fullwidth Featured Image of Custom Post Types in WordPress.?

This happens when the image does not have a specific width/height. The image you try to load in your custom-post-type is too small (379x354px). So LinkedIn, Facebook or others will use the layout with the smaller image. Facebook says: Images that are at least 470×246 pixels will display as a rectangle with the title and … Read more