Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Post Thumbnail is a theme feature introduced with Version 2.9. Thumbnail is an image that is chosen as the representative image for Posts, Pages or Custom Post Types.

0
votes
0answers
9 views

set the featured image of post as slider image

i am trying to set the featured image of a post as slider image in page , the problem the images that i get does not full the slider with , here is the code the i tried <!-- SLIDER CODE ########...
1
vote
1answer
36 views

How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts

How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts: i have this code here: add_action( 'wp_head', 'set_featured_background',...
-2
votes
0answers
18 views

Regenerate thumbnails is not working

I lost my all featured image suddenly, I don't know why that happened. Then I installed regenerate thumbnails plugin and regenerate all featured images again and again but nothing happens.. still no ...
0
votes
0answers
16 views

How to control resizing of additional image sizes

Is there a way to resize a custom image size in two additional sizes that are specifically for that image size? For example, I want to add the following image sizes to my WP theme, one for a full-...
-1
votes
0answers
18 views

How to change the layout of your posts [closed]

I have already figured out how to change my layout of posts to a grid layout (with the help of a plugin). But I couldn't find a plugin that has more possibilities. I would like to try a layout that ...
0
votes
1answer
73 views

How to display featured images for all posts with certain taxonomy label?

I have created a post taxonomy in functions.php called 'leadership' and then tagged posts with three different labels. I have a team page on which I want to place three links (each slugged to a label ...
1
vote
1answer
31 views

Delete all post meta except featured image Using SQL

Please I just migrated my site and I found out that wp_postmeta consumes most of my cpu resources, Is the any Sql code to Delete all post meta except the featured image. I dont want to Use wp ...
0
votes
0answers
11 views

How to add link to an image of a post in post slider(postboard)

I want to fix this issues without plugins. add_action( 'widgets_init', 'goodlayers_1_4_banner_init' ); function goodlayers_1_4_banner_init(){ register_widget('Goodlayers_1_4_Banner_widget'); ...
0
votes
2answers
31 views

Post thumbnail not displaying correct size

I created a custom template. It contains 3 columns, and the middle column should only display the post thumbnail. But no matter what size attribute I'm setting, it's not changing the size the way I ...
0
votes
1answer
37 views

Get Post's first image using Short-code

i'm trying to get post's first image(LINK) , Currently i'm using Shorcodes Ultimade plugin for it so far i'm able to get post's content using the following shortcode on my static homepage page [...
0
votes
2answers
11 views

How to show scaled featured image in template?

I need to show the post featured image at the desired position on my theme template. At the same time, I need its width to be 300px and the height- adaptive. What code should I add to my template?
2
votes
0answers
22 views

Save image as featured image

I am using WordPress 4.9.7 and I am trying to develop a plugin that downloads an image from a website and saves it in the media library and sets it as featured image on a post. Find below my full ...
0
votes
0answers
25 views

Use Lightbox effect for Featured Images

I'm trying to apply the lightbox effect to the thumbnails, since I don't want the photos to redirect to the direct url to them, and I've got no luck trying to set it up. I've tried adding this code ...
2
votes
1answer
34 views

Unexpected width and srcset attributes for the_post_thumbnail();

I am modifying a theme, using a child theme, and in a template file (single.php) I need to display a large post thumbnail, so I have this code: the_post_thumbnail('large'); In Settings > Media, the ...
0
votes
0answers
38 views

Delay WordPress auto thumbnails generation for specific image size i.e. 'medium'

I am trying to delay WordPress auto thumbnail generation for specific image size only i.e. 'medium'. As I am using GD library to print Post Title on the image automatically, and it replaces the ...
0
votes
1answer
17 views

about featured image

I am Seonhyang. I have my own blog which has been for a year. However I got a problem 2 weeks ago. When I uploaded the featured image for a post, an error occurred that made all my posts of its ...
0
votes
0answers
38 views

Thumbnail wouldn't scale to size properly

So I have a loop to display posts content, thumbnail, and the title. <?php echo "<div class='post-container'>"; while ($p->have_posts()) { $p->the_post(); $p->...
1
vote
1answer
27 views

fallback image for featured image

I want to use a fallback image if no featured image is set. I'm using the following code, but the image is not shown... <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?> &...
0
votes
1answer
16 views

How to add the option to choose between sizes for featured image within post editor?

Drew a blank Googling for this... Our website homepage shows a grid of featured image thumbnails on the home page. Some of these images are portrait and some are landscape. I would like to be able ...
1
vote
1answer
25 views

How do get post thumbnail into plugin?

I want to get post thumbnail into kk Star Ratings. I use this code: <img src="<?php the_post_thumbnail_url(); ?>" />'; But it not working. I inserted to index.php file, as: <!-- kksr-...
0
votes
0answers
14 views

Add another feature image box

I already have featured image box in my wp theme. So what I want: I want to add another featured image box at the top of my category section with different name something like custom featured image....
0
votes
0answers
17 views

Show blog entry image on “content-single.php” page for zerif-lite theme

I’d like to include the post’s image on the general blog page – the one where one can see all blog posts (link to my page here). I’ve included this <?php if ( has_post_thumbnail() ) { ...
0
votes
0answers
40 views

How to unset woocommerce thumbnail sizes

Is it possible to unset woocommerce thumbnail sizes? I added some code to unset that on functions.php, but it doesn't work. I think the plugin is overriding that piece of code. Here is my code. ...
0
votes
1answer
77 views

How to hide/remove featured images in particular categories post?

I have multiple posts in three categories. The categories are 1. News 2. Images 3. Videos If i click any post that Post's Feature image was shown in top of the article. But other two categories is ok ...
3
votes
1answer
36 views

media_handle_upload for local files?

I am creating an image on the server and storing it in a tmp folder. I would like to run a php file that takes this image, stores it in the default media directory structure and attaches it to a post ...
-1
votes
1answer
24 views

when i use wp automatic plugin post shows broken images

when i use wordpress automatic plugin content from some specific feeds are fetched properly but featured images not upload properly and shows like broken image. But when i copy link of that broken ...
0
votes
0answers
12 views

Is it possible to add another upload media in post section?

I am making a blog theme I have activated the featured image. Now I want to add another image upload like (feature image). How can I make it. Is it possible.
0
votes
1answer
24 views

Pulling in featured image into default recent posts widget

I've looked everywhere and can't find an answer to this, I have duplicated the default recent posts widget (not customising core) - I've added styles etc to it, however, when I try to pull in the ...
0
votes
1answer
60 views

has_post_thumbnail gives always TRUE

I am using this code in my template: <?php if (has_post_thumbnail()) { the_post_thumbnail(array(80,80)); } else { ?> <img src="http://example.org/<?php the_title(); ?>" ...
0
votes
1answer
13 views

How to set a post featured image from an already made custom field

So I migrated a website of a webdesigner and he used for news-posts a custom field for images. Now I made this website and I need to change 256 posts to set a featured image since it's not working ...
0
votes
1answer
22 views

How to retrieve the current post's generated featured image size?

Is there any way to retrieve the current post's generated featured image size, width and height. For example if any post's featured image set is of size 540 x 400, although it should be of 550 px x ...
-1
votes
1answer
25 views

Change background image in PHP

I have a post with the featured image. On my homepage, I want to display the featured image and the post title. But, in media screen < 576px , I want to display only the post title and "NO" ...
0
votes
0answers
15 views

Usage of add_image_size (for featured image)

I don't really get it. I use the function add_image_size to add a custom size so that I can display a feautred image with the nickname of the custom size. Using add_image_size I set the height to ...
0
votes
1answer
28 views

the_post_thumbnail() for displaying page feautred image?

I'm a bit confused about the usage of the function the_post_thumbnail(). I know that you can use it inside a loop to display the featured images of posts, but is it possible to use it to display the ...
1
vote
2answers
33 views

Display the featured image from the last post

I am building a category overview page and i am use this code: <?php $limit = 999; $counter = 0; $categories = get_categories(); foreach ($categories as $category): ...
0
votes
0answers
30 views

Featured image with Multiple images select

I want to add featured image meta box to multiple images select.I created one custom featured image meta box here I get same as like featured image but I want to add multiple image select option.I don'...
3
votes
0answers
111 views

Replacing Gutenberg Featured Image control?

I can replace the Featured Image control in current WP version by PHP: add_filter( 'admin_post_thumbnail_html', 'my_admin_post_thumbnail_html', 10, 2 ); How do I do the same thing with Gutenberg?
0
votes
1answer
64 views

How to add featured image with mutiple images

here I'm trying to add custom featured image to multiple images by default WP featured image but only one image we have to add. I want to add custom featured image with Multiple images for categories....
0
votes
1answer
14 views

How do I add thumbnail to current Prev and next buttons in posts?

The current Prev and Next buttons in a wordpress theme that I'm using is rendered from this function in functions.php: if ( !function_exists( 'krunk_post_navigation' ) ) { function ...
0
votes
1answer
24 views

Check if the image size is available and if not use 'full' image size

I have added an image size with code add_image_size( 'medium_post_thumbnails', 87, 63, true); By default WordPress has full/original image size. I have a function where I use above image size '...
0
votes
0answers
8 views

Featured Images No Longer Cropping After Move to Amazon S3

Originally, any featured image would be cropped to the same proportions for the widget areas of our theme. However,since the move to Offload S3 Lite this has stopped. Images are now shown with their ...
0
votes
0answers
44 views

In app browsers (instagram app etc.) not displaying video thumbnail on my wordpress site

EDIT: I figured it out! It's simple. If anyone will ever face the same issues this is what you need to do. Click on video (it's in my product description), click on edit, click on select poster image ...
0
votes
1answer
20 views

Add “Featured Image” box in my plugin post page

I'm creating an Wordpress plugin where I'll have a fully customized custom post form. How can I add "Featured Image" box in my form? For example, wp_editor() function shows TinyMCE editor. Is there ...
0
votes
0answers
30 views

Add featured image to feed BEFORE excerpt

I'm making a feed for a newsletter. The content of feed must to have a rich text excerpt and a featured image. This hook seems to work: function add_feed_content($content) { if(is_feed() &&...
0
votes
2answers
85 views

Override has_post_thumbnail function

Is there a way to alter/change core has_post_thumbnail function? I need to check folder on server with images first before code looks for post image attachment. I see lots of filters to change image ...
0
votes
1answer
36 views

featured image in custom poste type (backend)

I created a custom post type outside the wordpress loop. I want to integrate the featured image meta box in the backend for this post type. $this->add_meta_box('postimagediv','Beitragsbild', array(...
0
votes
0answers
16 views

Generate a thumbnail only for the first image & resize images if too big and delete originals

I built a plugin that for each new post, it uploads 5 pictures (from URL). The first one is the Thumbnail and the other 4 images are regular attachments. I'm using the code on the following topic and ...
1
vote
1answer
193 views

How do I get images (with a thumbnail preview) to show in search results?

The Short Version I've constructed a Wordpress site (Gazette theme base) with lots of image media. All have descriptions, captions, and titles but do not show up in search results; using Relevanssi I ...
0
votes
1answer
100 views

wordpress get_the_post_thumbnail can't set size

I have wordpress with multisite, so it will be pc and mobile version. On my pc version, i can use wp_get_attachment_image_src(get_post_thumbnail_id($id), array('210','210')) But on my mobile version, ...
1
vote
2answers
48 views

Possible to swap in a placeholder image globally for the_post_thumbnail_url if one doesn't exist?

I am working on a new theme for a site, but the majority of the posts don't have a featured image set. Throughout the new theme I am pulling in featured images using the_post_thumbnail_url. I am ...