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

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
15 views

Something in parent theme is preventing child theme from being able to crop images

I have a dilemna where I can't crop images with add_image_size() in my child theme. Instead of cropping, the images are scaled. I've tried all the usual stuff like regenerating images and changing ...
-1
votes
2answers
40 views

Get Post Thumbnail Outside of Loop

I am trying to get the post thumbnail image for each accordion or show accordion post thumbnail outside of the loop. Currently, it's setup with image empty but I need each thumb to represent the ...
0
votes
0answers
25 views

Adding Featured Image Programatically [duplicate]

I have thoroughly read the documentation my function is function set_featured_image($image, $post_id){ $image_path = '/var/www/html/wp-content/plugins/apkplugin/images/'; $wp_filetype = ...
1
vote
0answers
11 views

Video processing using ffmpeg in Wordpress (Video preview)

I want to preview the submitted video articles. As a clear example; youtube video thumbnails. But I'm not talking about a fixed image. When the mouse is over the thumbnail, it should show a few frames....
0
votes
0answers
29 views

Get Thumbnail from Page link or Taxonomy Slug

kind of struggling with a task but also writing to see if what i'm doing makes sense. Simple question is I can't return the thumbnail in a foreach loop. Background is I am using a taxonomy to map ...
0
votes
2answers
20 views

Is it possible to show thumbnails along with recent post from a wordpress blog on static website's homepage?

Please help me to figure this out that I want to show thumbnails along with recent post from a wordpress blog on static website's homepage. Following code are working fine but I need to show one ...
0
votes
0answers
12 views

Set featured image from video

I'm working on a Wordpress website and I have created a category for videos. I created an article with video as the format, and I inserted a youtube video in the content. When I view the article, ...
0
votes
0answers
17 views

Image size in browser is defaulting to fill the container despite editor / styling settings

I am in the process of building my first theme. I have built everything up slowly and have a very simple setup. Now I am stuck on something that is probably a very easy fix. Problem: When I add an ...
1
vote
1answer
53 views

Adding Featured Image to Post programatically

How do I add a Featured Image programatically, given the URL/filename of the image, and Post ID associated with it?
1
vote
1answer
53 views

Featured images not displaying at full resolution

The image in my media library is 560×315, but when I inspect the image this is the code I find. srcset images are being loaded instead of my full resolution image. <img src="https://domain.com/...
0
votes
0answers
7 views

Display child page featured image on parent page and link together

I have a parent page that is based on Template A. Under this page is a child page on Template B - on this page goes the content and has a featured image that I need to get on parent page. So the idea ...
0
votes
0answers
7 views

Select image from post and make it featured image

I'm trying to use images in post as thumbnail if the post hasn't thumbnail, but it's doesn't work function homepage_get_attachment( $num = 1 ) { $output = ''; if( has_post_thumbnail() && $num ...
0
votes
0answers
27 views

How can I use an image from an external source without uploading it to the media library

I am looking for a way to tweak my xml parser code to insert a url from an external source into a new post, instead of first uploading it to the website's media library and than adding the attachment. ...
0
votes
0answers
21 views

Why image Thumbnail url is not displaying with custom size?

The website has only one thumbnail size 375x211. I want to show this size thumbnail image at site homepage so that when I copy this image it only copies in 375x211 size, not in full image size which ...
0
votes
1answer
20 views

How to link featured images in single.php for only non-logged-in users?

I want to link featured images of every WordPress post automatically for only visitors. So it should not be available for logged-in users of WordPress. It should only link featured images of single....
0
votes
0answers
18 views

Cannot change links to old legacy thumbnails

I have a wordpress installation where the content has been imported from another very old version of wordpress in order to rebuild the site and modernise it. However, upon selecting various themes and ...
0
votes
2answers
24 views

WP_Query how to add a thumbnail to the first post from the last 5 posts?

I've a query like this: <ul> <?php $the_query = new WP_Query( array( 'cat' => '1', 'posts_per_page' => 5 ) ); ?> <?php while ($the_query -> have_posts()) : $the_query -> ...
-1
votes
1answer
27 views

Use Post Title as alt text for Featured Image

There are previously-asked questions but either they don't work with my theme or I'm too stupid to figure them out. Essentially my chunk of code is below and I'm using the Avada WordPress theme (you ...
0
votes
0answers
17 views

Featured image: How to only show the width and height of an image when there's a featured image?

I've found a way to display the width and height of a featured image in the admin panel. The problem I have now is that if there isn't an image, it shows the 'x' above 'set featured image'. How do I ...
0
votes
0answers
20 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
56 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',...
0
votes
0answers
17 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
vote
2answers
158 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
41 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
36 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
13 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
49 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
53 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
39 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
19 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
38 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
18 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
36 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
1answer
17 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
20 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
88 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
359 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
81 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
34 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
1answer
52 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
137 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
30 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
21 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
36 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 ...