Questions tagged [post-thumbnails]

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.

Filter by
Sorted by
Tagged with
71 votes
5 answers
137k views

How do I set a featured image (thumbnail) by image URL when using wp_insert_post()?

While looking through the function reference entry for wp_insert_post(), I noticed that there's no parameter in the array it requires which will allow me to set the 'Featured Image' for a post, ...
Chris's user avatar
  • 775
21 votes
5 answers
17k views

How can I make add_image_size() crop from the top?

I have a series of posts, all with featured images, but I need to be able to customise the crop top right corner. In this instance, I need them to be cropped from top right, but it would be useful to ...
Mild Fuzz's user avatar
  • 4,170
30 votes
6 answers
206k views

How to Fix HTTP Error When Uploading Images?

I am using WordPress 3.4.1 on Ubuntu 12.04 using Apache and PHP 5.3.X When I login to the dashboard and add a new post. Then try uploading an image to set as a featured image, I get a red box with a ...
Michael Ecklund's user avatar
4 votes
2 answers
9k views

Retrieve 1st image in post and set it as featured image, when post is saved/updated

I need to set a featured image for every post I publish. So, when a post is published/updated, the script would scan the post for the first image using a script like this: // Get URL of first ...
Gixty's user avatar
  • 1,087
36 votes
4 answers
28k views

Filter to remove image dimension attributes?

I'm working on a site based on a fluid width css template which sets a max-width on images to the width of the column containing them, and I need to remove the inline width and height dimension ...
goldenapples's user avatar
  • 9,236
16 votes
4 answers
35k views

How to set featured image to custom post from outside programmatically

I am trying to fetch and insert images outside the wordpress environment to a custom post via PHP. How to move/upload that image to wordpress upload directory year date folder format just like ...
Faisal Shehzad's user avatar
7 votes
5 answers
21k views

Set Featured Image Front Frontend Form

I have been struggling for days to figure this one out. I have successfully implemented a form to submit posts from the front end of my site. ButI can't figure out how to make the image uploads work. ...
Eckstein's user avatar
  • 1,099
36 votes
6 answers
160k views

How to get image title/alt attribute?

In my white theme, there is no alt attribute configured for the home slider post. I added the alt text for the image through the media library interface. I added the following code to display the alt ...
Nisha_at_Behance's user avatar
26 votes
4 answers
105k views

Add class name to post thumbnail

I'm using post thumbnails to link to a page. Is it possible to add a class name to the post thumbnail image. <li><a href="<?php the_permalink(); ?>" ><?php the_post_thumbnail(); ...
Simon Cooper's user avatar
12 votes
6 answers
38k views

Get the first image from post content (eg.: hotlinked images)

I am using this code directly from the codex. function echo_first_image ($postID) { $args = array( 'numberposts' => 1, 'order'=> 'ASC', 'post_mime_type' =>...
byronyasgur's user avatar
  • 3,022
9 votes
1 answer
23k views

Upload post thumbnail from the front end

We would like users to be able to upload the post thumbnail when editing posts. How would this be done. I would imagine it would make use of the ajax functions of wordpress. Any ideas, Marvellous
Robin I Knight's user avatar
5 votes
2 answers
2k views

Differentiate Featured Image from Post Images upon Upload

I want to differentiate the featured image from post images. The plan is to give the Featured Image multiple sizes, but the images inside / connected to the post only needs the default sizes. I ...
Howdy_McGee's user avatar
  • 20.5k
5 votes
1 answer
6k views

oEmbed, thumbnails and wordpress

Wordpress has wp_oembed_get, which I use to get rich media content with embed.ly. I've previously used oEmbed api calls such as this. As you can see it provides thumbnail_url, which I like to use ...
FLX's user avatar
  • 1,007
33 votes
8 answers
7k views

User-friendly cropping of post thumbnails?

Is there a way to let my users define the crop area of a post thumbnail? The thumbnails always are existing post attachments, I would rather not create an extra attachment per thumbnail. The post ...
Jan Fabry's user avatar
  • 30.4k
21 votes
6 answers
26k views

No Thumbnails Generated

I setup WordPress on my own server and it's up and running...one thing that I have noticed is that WordPress doesn't generate any images I upload. Usually when I upload an image through WordPress it ...
Josh Rodgers's user avatar
  • 1,173
19 votes
9 answers
24k views

How to disable WordPress from creating thumbnails?

I've been looking around the net for a long time on how to disable WordPress from creating multiple thumbnails. I've seen in most tutorials to set all the images to 0 in the media section. I have ...
Daniel's user avatar
  • 189
17 votes
8 answers
37k views

Stop wordpress from hardcoding img width and height attributes

I'm wondering if there's a simple way top stop WordPress automatically hardcoding featured image height and width attributes, other than using regex... As I'm using a flexible grid for my project (...
Richard Sweeney's user avatar
16 votes
1 answer
12k views

Setting a post's featured image from an embedded YouTube video

If I create a post that has an embedded YouTube video in it (so all I do is paste the YouTube URL into the post and let Wordpress automatically embed it for me), is there a way to have the thumbnail ...
Piku's user avatar
  • 263
8 votes
3 answers
3k views

New image size version only for the Featured Image file

I'm worried about too many files created when adding a new image size. All uploaded files will generate the new size, I need a specific image size only for the file set as Fetured image, is there ...
Diana's user avatar
  • 1,238
7 votes
4 answers
10k views

Make featured image required

Is it possible to force user to set featured image on some types of posts. For example I've got custom post type mm_photo and I want to show some error message or somehow block user from publishing or ...
Adam's user avatar
  • 351
7 votes
2 answers
8k views

Using add_theme_support inside a plugin

I've created a custom post type as a plugin and released it into the repository. One of the core features involves using a featured image. I've added thumbnail to $supports in register_post_type(), so ...
Ian Dunn's user avatar
  • 4,817
6 votes
6 answers
36k views

How to find attachment by it's name?

Is it possible to get attachment id by its name? And at once may be it's possible to get parent post, to which this attachment is assigned?
Kirix's user avatar
  • 179
5 votes
1 answer
4k views

media_sideload_image generates blank?

I'm creating a custom post form that is supposed to take an external image and uploads it to the media library and attach it to that post. This should be possible by using media_sideload_image, but I'...
FLX's user avatar
  • 1,007
5 votes
2 answers
5k views

Featured Image of Video from oembed

For Wordpress, I want to auto generate thumb of the video embedded on a page using oembed? And then save it as a featured image of the post. Any idea how to do this?
Krunal's user avatar
  • 221
2 votes
1 answer
2k views

set and unset the custom field value

While showing all the posts together in admin panel, I have a custom column 'Featured Image'. And this column has a value YesOrNO. To set the column name : I have inside functions.php: function ...
Istiaque Ahmed's user avatar
15 votes
6 answers
10k views

Minimum Dimensions Requirement for Featured Image?

I am creating a baseball website with multiple Authors. From past experience, no matter how well you know someone personally, it doesn't mean they will follow or even read your instructions. That ...
Travis Pflanz's user avatar
14 votes
2 answers
17k views

set_post_thumbnail_size vs add_image_size

What is the difference between set_post_thumbnail_size and add_image_size? Is set_post_thumbnail_size for all images, and add_image_size for sizing images individually? Thanks.
Greeso's user avatar
  • 2,116
12 votes
1 answer
2k views

How to disable generation of default image sizes for some custom post types?

I used custom post type, where 'thumbnail', 'medium' and 'large' sized not required. I need to disable this sizes and create function or plugin, where i can set, which image size is required for each ...
Bohdan Hdal's user avatar
11 votes
5 answers
40k views

Can I set a default featured image for a category?

I'm setting up a site with a theme that takes advantage of the "featured image" feature of WordPress. Since my end users are not the most tech saavy in the world, I'd like to set things up so that the ...
Dillie-O's user avatar
  • 1,551
9 votes
8 answers
7k views

Delete original image - keep thumbnail?

I'm using a lot of thumbnails but never the original file. To save space, I'd like to prevent the original from being saved on disk but only keep a thumbnail of 100px. How can I do this? Thanks, ...
FLX's user avatar
  • 1,007
8 votes
1 answer
7k views

Can I refresh the thumbnails programmatically?

I would like to be able to refresh the thumbnail cache programmatically, not sure where to hook it, but at present any design changes mean re-uploading loads of images!
Mild Fuzz's user avatar
  • 4,170
8 votes
5 answers
18k views

Get featured image on Blog Index

I've been trying to use the "featured image" from the home (the blog index) with no luck. It's working for every single page, but it's not working for the home. The code looks something like this: //...
demogar's user avatar
  • 183
7 votes
5 answers
6k views

change set_post_thumbnail_size according to post type admin page

I have a few custom thumbnail sizes and obviously one of them is used in the set_post_thumbnail_size, what directly affects the interface in the admin area. What I'm looking to do is to intercept ...
Amit's user avatar
  • 1,349
5 votes
2 answers
20k views

Display Post Thumbnail Without Being Featured Image

I'm hoping that I can explain what I'm going for here. On my current project's main page, I'm displaying each post's Featured Image Thumb, along with an excerpt of the post's content. In each of the ...
Anthony Myers's user avatar
5 votes
2 answers
3k views

Prevent publishing the post before setting a featured image?

As the title says , I want a plugin/function to prevent/inform the user when he tries to publish the post without setting the featured image. ANY HELP ???
BIALY's user avatar
  • 59
4 votes
2 answers
4k views

Check for featured image in WP_Query

Is there a way to filter posts by featured image when initialising a WP_Query object? Example $my_query = WP_Query(array("has_thumbnail"=>true)); or, more ideally $my_query = WP_Query(array("...
Mild Fuzz's user avatar
  • 4,170
4 votes
3 answers
32k views

Remove title attribute from images

I'm looking for a way to remove the title attribute from images, preferably through using a hook or a filter. Most clients don't bother giving images a proper title, thus eliminating the purpose of ...
heintore's user avatar
4 votes
4 answers
2k views

What is your take: TimThumb vs. WordPress Thumbnails? The great debate [closed]

When it comes to excerpts, do you believe TimThumb or WordPress thumbnails is the way to go? And why? Answers will not be graded (but may be criticized).
Lucas's user avatar
  • 220
3 votes
2 answers
1k views

Change wording of default thumbnail metabox

I want to change the wording in the Default thumbnail metabox to 'Set default thumbnail' instead of 'Set featured image'. How can I do this?
urok93's user avatar
  • 3,984
3 votes
2 answers
637 views

Add Image Dimensions to Media Library Tab on Media Upoader

I would like to add the dimensions of each image to the media library tab in the media uploader. I have a multi-author website, where I require users to add a featured image with minimum dimensions. ...
Travis Pflanz's user avatar
3 votes
3 answers
4k views

How to grab first image attached to post and display in RSS feed?

I've seen the tutorials on how to grab the first image and display it in a post, and those on grabbing the post_thumbnail and using that in the RSS feed, but does anybody know how to grab the first ...
RodeoRamsey's user avatar
  • 1,707
2 votes
2 answers
6k views

How to replace the_post_thumbnail template tag and show the first inside the post image instead

I want WordPress to return the first post image or a default image if no featured image has been set. My theme uses the_post_thumbnail many times, so I don't want to go through and change all ...
Zade's user avatar
  • 189
2 votes
2 answers
7k views

wordpress custom walker for thumbnails with custom menu

I'm still very novice at PHP so any help is greatly appreciated. Typically I have found the codex to be very helpful but it appears custom walkers may be outside its scope. I'd like to have ...
javy's user avatar
  • 23
1 vote
2 answers
3k views

Why are image thumbnails cropped proportionally (not per dimensions)?

For some reason WordPress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in functions.php: add_image_size( 'main-...
5AMWE5T's user avatar
  • 149
1 vote
2 answers
488 views

How to get the image sizes, in a function, as per the sizes mentioned in the media settings?

I'm making a custom function for my WordPress site. function mediumFeaturedImage() { if ( has_post_thumbnail() ) { ?> <a href="<?php the_permalink(); ?>"> <?php ...
Mayeenul Islam's user avatar
1 vote
2 answers
4k views

Display child pages on a parent and child page using Featured Thumbnails

How would I display a list of my child pages using featured images on a its parent page as well as its other siblings child page? For example, if my parent page is called 'Music', I'll have my main ...
David's user avatar
  • 11
1 vote
1 answer
2k views

get_pages - Display child then grandchild pages

I have a page structure like this. Portfolio - Residential - - Resident 1 - - Resident 2 - - Resident 3 - Commercial - - Commercial 1 - - Commercial 2 - - ...
Simon Cooper's user avatar
1 vote
1 answer
181 views

Query the post which have a thumbnail

I've got a highlight section on the header of my website which shows the title and the thumbnail of the last X posts having a thumbnail. Is there any custom query which allows me to retrieve only the ...
koskoz's user avatar
  • 245
0 votes
1 answer
1k views

VT-resize image and display it [duplicate]

Possible Duplicate: Retrieve 1st image in post and set it as featured image, when post is saved/updated I am trying to make this works and instead of giving me the url of the image, it is giving ...
Gixty's user avatar
  • 1,087
0 votes
1 answer
2k views

How to add a background image to category and display image on category page

I have categories on my website. I have to add a background image to each category while creating the category without using any plugin. I tried some code in function.php and I refer this link. but ...
Naren Verma's user avatar