Check out get_the_post_thumbnail()
$image_thumb = get_the_post_thumbnail( get_the_ID(), 'thumbnail');
Here’s a more specific example:
while (have_posts()) : the_post();
echo '<article class="search-entry clearfix">';
$image_thumb = get_the_post_thumbnail( get_the_ID(), 'thumbnail');
echo ( $image_thumb ) ? sprintf('<a href="https://wordpress.stackexchange.com/questions/168885/%s" title="https://wordpress.stackexchange.com/questions/168885/%s" class="search-portfolio-thumb">%s</a>', get_permalink(), get_the_title(), $image_thumb) : '';
Related Posts:
- How can I get the title attribute from get_the_post_thumbnail()?
- Set Featured Image for Archive templates
- How can I add a set featured image function to a theme that doesn’t already have it built in?
- How do you get thumbnails to show up in the admin edit post?
- 100% width Featured Image Size
- Featured images, am I missing something?
- Recommended Media Size for Twenty Fourteen
- get_the_post_thumbnail() produces different HTML on same arguments
- Migrating a website using custom image tags to use featured images instead
- How do I get the featured image to sit below the header in the twenty nineteen theme?
- Edit box-header on WordPress Dashboard
- Featured images are cropped on index and post page
- Theme stops media uploader from working
- Featured image on page is not displayed with certain theme: how to debug this?
- Installation failed: Download failed. No working transports found
- What is theme-compat?
- No “Add New” Button. How to add new theme?
- Splitting an Evolving Site into Multiple Sites, or Maintaining as One Site?
- How to display date such “x ago”
- How to use same theme template for multiple taxonomy terms?
- WP Video media player not loading correct CSS after AJAX load
- How do you install a .MO (language file) to use as part of a theme?
- Specific theme for non logged in users
- Cannot find the code for “Edit This” link in posts in a specific theme
- How to change the contact info at the bottom of my theme [closed]
- Customize “Continue Reading” text [closed]
- WordPress not displaying themes in the wp-content/themes folder
- How to create child theme of already active and customized theme
- Console error, even if everything is working?
- How To Remove The “Delete” Theme Option In Dashboard
- How Do I Use A Custom Mobile Theme?
- How can I make a different theme be viewed for logged in users vs guests?
- Custom branding / theme specified by URL
- New custom theme option (text input) giving index error
- How to stop twenty fifteen theme from cropping featured images?
- CSS for triggering Avada toggles using an image or clickable element [closed]
- What is calling this parallax-slider.less file that is missing? [closed]
- Random 404 error on WP
- Change WordPress Theme automatically for A/B test
- Theme option not saved if in wp_editor() and html decoded
- style.css not reflecting changes. I have no cache installed
- the_content() is not displaying content, why? [closed]
- Permissions for installing themes and files in general?
- Frameworks for Premium Theming [duplicate]
- Remove problem PHP code entered into footer via Theme
- Twenty Seventeen search error
- Protect shortcodes, custom JS, and CSS from theme updates
- Free WordPress theme for an intranet tutorial site [closed]
- How do you remove a broken theme from WordPress Admin (without FTP or Cpanel)
- Why are so many popular responsive WordPress themes “boxed” at 940px? [closed]
- Theme Modified By Updates
- I want to develop a theme using WordPress. Which theme should I start from or develop from scratch? [closed]
- Background image appears on localhost site but not online
- Remove Commenting on Certain Pages
- Pages and posts on ElegantTheme featured slider [closed]
- Error when installing theme – “failed to open stream: No such file or directory in…”
- disable default widgets in Responsive theme
- Theme seems to have different options on wordpress.com and own-server install
- how would I change background color of a theme using a plugin?
- Child theme breaks after update of master theme
- Insert the current theme header into an external HTML/XHTML file
- How to use one git (github) repository for version control for multiple themes
- brand section in wordpress lost after change theme
- How i can put on my wordpress the demo of a theme?
- WordPress keeps switching back to empty template
- sidebar in 2020 theme as a widget
- Remove the breadcrums on a theme W
- WordPress ajax insert and delete if already inserted delete the post id stored in custom table
- Tinymce button is not visible for a theme
- Serve resources from a consistent URL GT Metrix
- Change the main width of Twenty Thirteen theme
- How to display post meta data in secure manner
- theme continuous deployment from bitbucket to windows azure
- Will this js code work in a page template?
- Create /archive page in WordPress Theme
- separate home page into separate pages
- Moving WordPress with Super Skeleton theme
- How can I allow a client to edit certain parts of a static site?
- To create a theme or use an existing one? [closed]
- Overwrite functions.php of a theme – What if the theme is updated?
- How to add/edit content Custom Content item in theme
- Is there a WordPress theme for twittstrap? [closed]
- change template with button
- How do I remove the dash (-) between my Site Title and Tagline?
- Obtaining the original unchanged Theme [closed]
- How to assign posts to different themes? [closed]
- register_nav_menus syntax error, unexpected identifier “register_nav_menus” in
- My theme is not translated
- Wrong theme being activated
- RTL in posts only [closed]
- Blocking Google Fonts in wordpress website
- I am unable to remove “© 2022 My Blog | PopularFX Theme ” from footer [closed]
- Workaround AJAX calling without directly calling WordPress backend (Admin dashboard) because it is restricted to the end user (the public)
- css on body tag in editor
- Migrating a Bootstrap 3 Website to WordPress
- How do I remove the hamburger menu from the Twenty Twenty Four theme?
- Stiff-necked themes
- Does WordPress maintain revisions for index.html template?
- Tried to install new theme
- Trouble with formatting buttons in WordPress:Twenty Twenty-Four [closed]