Use get_the_post_thumbnail with a new WP_Query.
<?php
if ( has_post_thumbnail()) {
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >';
echo get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'aligncentre'));
echo '</a>';
}
?>
Related Posts:
- Get the children of the parent category
- How to check if I’m on the last page of posts?
- Can I set a default featured image for a category?
- Should category.php and The Loop be used if the query needs to be customizable?
- How can I add the featured image functionality to a custom taxonomy?
- Exclude the category from the WordPress loop
- How do I get the category URL from get_the_category?
- How can I make post fields required in WordPress?
- get_field not displaying my custom field value
- Default WP Gallery – show only galleries of a certain category
- Rearranging posts based on categories
- WP_Query not looking at child category
- Randomise results from a category page?
- Display all posts in category, with specific tag posts at top
- Show div only if post is in specific category
- How to show a category post to a specific registered user
- Display list of Sub-Categories and the posts they contain, within one main Category
- Loop with Dynamic Categories
- How to add icon over specific thumb
- Limit Loop to One Category
- List post only under the category, exclude child category content
- Filter Category Loop Dynamically
- Editing Loop So It Targets Specific Tags?
- the_category() doesn’t working in wp_query loop
- Conditional category query breaking?
- Problem: retrieving parent category’s first post
- How to add image for all posts associated to specified category?
- How to get posts using category slug in ClassiPress?
- Category sticky latest
- Posts made to category don’t show up (do show up on frontpage)
- Exclude posts without category from loop
- Category name for all posts getting assigned to a single random post
- Category post count is not correct
- Display all categories but only if they have posts in them that have a specific tag assigned
- Include last post date in get_categories loop
- How to display WooCommerce category image in my category page banner as a background?
- Show the number of the post
- How can I order all subcategories alphabetical independent of the parent categories?
- How to get specific (grand parent) category of current post?
- How to make product image inherit from category image
- Custom Loop with certain number of one category
- how tho change number of posts in loop from specific categories
- show thumbnail for subcategory wordpress
- Template category.php with page (no posts)
- error in specific category loop
- loop in single.php of the same category
- How to create a category loop on my blog (ACF Plugin)
- Please tell how to stop the category from showing up on posts
- Hide a category/posts from the homepage in wp
- How to hide/remove featured images in particular categories post?
- Loop by category and meta_key
- How to show category image if no featured image is set?
- Assign a class to first element in category in loop
- Displaying Category in sidebar post widget but not in the loop on home
- Querying posts from two different categories while looping inside another loop
- Trying to display all posts in a category
- Custom field picture instead of post thumbnail on category page
- Category page shows only 1 post when that post has more than 1 category?
- Loop doesn’t work
- Configure query with multiple categories in a custom order?
- Display Taxonomies in loop with template args
- How to loop through a custom field for each post, & display?
- show category name before first posts in each category
- How can I modify this code to iterate over an array of categories?
- Loop within category’s posts
- How to exclude a specific categogy from a custom page template
- Display one post on category.php: Wrong featured image
- Loop through posts of CatA and store value of CatB in separate array
- How to add an empty entry to masonry?
- WordPress Numeric Pagination with Query String [duplicate]
- Loops in category description
- How to get multiple loop in category.php, my scripts becomes madness
- Several loop in search result
- Printing direct descendants of a category with WP_Query
- Category slug in in loop always the same?
- How to enable admins/editors to set a featured image for specific category?
- Custom Category Page Not Working [duplicate]
- how to get number of posts in a category on a specific date
- Show posted on date only for posts in a certain category
- 2 loops in archive.php (one for each category)
- My Query is getting the wrong data
- Detecting top parent category fails on home page
- How do i add custom post types to this query?
- Using pagination with multiple loops causes it to break
- Custom loop by url
- Custom WordPress category page showing all posts rather than the specified category
- How do I hide posts in a category from all listings but still allow the posts to be viewed?
- Featured image for links and categories
- How to create a custom loop ordered by Categories on a Page Template?
- Do not show all post from all categories, just show posts from category in current loop
- IF have_posts contains posts from a certain category
- Show thumbnails 1-12 of category x on any given page
- How to display the category featured images [closed]
- Echo Category In Loop
- How can I implement pagination on custom category page?
- Order Categories by Character Count
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing
- Get categories by title descendant
- Elementor : display only one category in loop grid
- Different number of posts in regular loop and CPT category page