Can I get thumbnail of taxonomy?

you can use advanced custom field plugin for better use // get the current taxonomy term $term = get_queried_object(); // here is the taxonomy image $image = get_field(‘image’, $term); Or You can use free plugin in your template URL: https://wordpress.org/plugins/wp-custom-taxonomy-image/ if (function_exists(‘get_wp_term_image’)) { $meta_image = get_wp_term_image($term_id); //It will give category/term image url } echo $meta_image; … Read more

Get featured image and additional posts thumbnail WordPress REST API

(function($){ $(document).ready(function(){ var items = []; $.getJSON(‘https://localhost/wordpress/wp-json/wp/v2/posts?category_name=portfolio&per_page=50&_embed’, function(response){ console.log(response); $.each(response, function(key,val){ //console.log(val._embedded[‘wp:featuredmedia’][0].source_url); items.push(”+”+ ”); }); }); }); }(jQuery)); //use variable array to push data

WordPress 5: including larger thumbnail image sizes in srcset than I have set

Good question as I know that this can be a pain in the butthole. Please see this page; https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/. From the docs: get_the_post_thumbnail_url($id, ‘image-size’) So in your case: $img = get_the_post_thumbnail_url($post, ‘article-lede’); echo “<img src=”https://wordpress.stackexchange.com/questions/353305/{$img}” class=”featured-image img-fluid” />”;

Get post thumbnail in specific size

First, you have to add custom image size using add_image_size, so when you upload new image using media uploader it will create thumbnail of that size which you assign for image. in add_image_size $crop parameter If false, the image will be scaled (default), If true, image will be cropped to the specified dimensions using center … Read more

Show thumbnail depending on image width

I think the problem is that you’re trying to get the metadata for an image without specifying which size you want the width and height from. $imgData = wp_get_attachment_metadata( get_post_thumbnail_id( get_the_ID() ) ); $width = $imgData[‘width’]; $height = $imgData[‘height’]; Instead try this: $imgID = get_post_thumbnail_id( get_the_ID() ); $imgURL = wp_get_attachment_image_src( $imgID, ‘full’ ); // now … Read more

How to show Thumbnail size, caption, extension in WordPress?

Use the Following code, <?php // Get the Featured image ID $thumbnail_id = get_post_thumbnail_id( $post->ID ); $image_data = wp_get_attachment_image_src( $thumbnail_id, ‘full’ ); $image_url = $image_data[0]; $image_width = $image_data[1]; $image_height = $image_data[2]; // Caption $get_description = get_post( $thumbnail_id )->post_excerpt; // Extinsion $mime_type = get_post_mime_type( $thumbnail_id ); $mime_type = explode( “https://wordpress.stackexchange.com/”, $mime_type ); $extinsion = $mime_type[‘1’]; ?>