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.

411 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
809 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?
4
votes
1answer
465 views

Featured image upload finished hook

I'm looking for a way to hook into the process of uploading a featured image. Ideally I would want to be able to do some stuff right when the upload has finished, before the thumbnails are generated. ...
4
votes
2answers
3k views

How to get featured post title & image using JSON API?

Is there any possibility to get featured post title and image using the JSON API. I tried using this: example.com/?json=the_post_thumbnails&count=3 But instead of recent posts, I get featured ...
3
votes
1answer
3k views

wordpress responsive image srcset not working

I'm trying use wordpress core responsive image feature but it's not adding srcset to image. Here is th my codes I have a div w=370px h=280px now I added image sizes if(function_exists('...
2
votes
1answer
55 views

Get image of latest post from taxonomies/categories

I have a custom post type "Artworks" with a custom taxonomy "Artists". I have a page where I list all the entries from the "Artists" taxonomy (Artist 1, Artist 2, Artist 3, etc.). How can I get the ...
2
votes
0answers
224 views

Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type

For a Wordpress project I made a Custom Post Type in the usual manner. Also i made a custom role. I want users with that role to be able to make, edit and delete this CPT. I added the apropriate ...
2
votes
0answers
34 views

How to delete posts that does not have a thumbnail?

I have a problem with my blog. The thing is this, all the posts have a thumbnail in this address: wpbv_postmeta-->meta_key-->thumb And several (A LOT) of posts don't work, because I have made a ...
2
votes
0answers
176 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 ...
2
votes
0answers
785 views

create new post using rest API and set featured Image from an external link

I am new to Wordpress. I need to create a new post from the Rest API which has its featured image from an external link. I can successfully create a new post using the rest API plugin, how do I add ...
2
votes
1answer
419 views

How to make thumbnail image fit into a div where image dimentions are completely different?

I defined a div which is 200px * 200px for my thumbnails using the code below in my index.php file: <ul> <?php $my_query = new WP_Query('showposts=10&cat=3'); while ($my_query-&...
2
votes
1answer
1k 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 ...
2
votes
0answers
761 views

ACF image field to WordPress featured image

I am working with a CPT that is using ACF fields to manage content and the hero image. With the new Archive page template, I wish to have featured images alongside the content. Earlier we did not ...
2
votes
0answers
21 views

Replicate featured image functionality

Is there a wordpress way of creating a custom field just like the Featured Image field? The field should be implemented in my custom meta box on the post edit page at the back-end.
2
votes
0answers
1k views

AJAX image upload with a upload progress bar using media_handle_upload

I currently have post image upload for the featured image from front-end form. <input type="file" name="wh_image_upload" id="wh_image_upload" multiple="false" /> and using media_handle_upload ...
2
votes
0answers
106 views

Image Editor does not affect custom sizes!

Recently working with wordpress 3.5, I came across this patch :http://core.trac.wordpress.org/ticket/19889 ...which solved the problem of custom image sizes defined by my theme not resizing or ...
2
votes
0answers
1k views

Featured image metabox not showing up

I have a theme installed on WordPress Multisite 3.5.1 which has a one custom post. Now I wanted to have two more so I have created them. Everything is working besides one thing. The featured image ...
2
votes
1answer
231 views

Hide upload image fields for the different media upload popups

I am trying to change a few of the options in the Set Featured Image popup in the Wordpress admin. I can't seem to find anything that determines if the popup window is a Featured Image or an Add Media ...
2
votes
1answer
169 views

Converting Attachment to Images?

I've had no problem using lightboxes before with attachment images, but I've switched to a new theme called Quicknote and it seems that attachment images now instead link to the attachment page. ...
2
votes
2answers
416 views

How to check if user is uploading/setting an image as a featured image?

I'm making a limitation for image upload based on @brasofilo excellent snippet. In short, it limits user to only uploading image with minimum dimension. However I want to apply this only when user is ...
1
vote
0answers
20 views

Duplicated featured image is not showing

I have a site where I upload Apkmod file that's why I have to upload dozens of post daily but some time by mistake I upload the same post with the same feature image and I don't want my site work ...
1
vote
0answers
19 views

Using featured image from another page

I have the following code which, if a page is a sub-page of 'Portfolio' (ID 12), will use the featured image of the Portfolio page rather than it's own. However, I also have a page of 'Services' with ...
1
vote
0answers
24 views

Media Gallery Upload photo incorrect way like glitch

I start having this issue like 3 days ago, I disable all plugins but nothing works. See the examples: Original photo: after I upload:
1
vote
1answer
30 views

How to stop twenty fifteen theme from cropping featured images?

The twenty fifteen theme always crops featured images, it cuts from both lower and upper part of the image usually. How to prevent it? How to show the normal (full) dimensions of featured images? In ...
1
vote
0answers
16 views

Error get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title

function custom_pic_alt( $attachment_ID ) { // Get ALT $thumb_alt = get_post_meta( $attachment_ID, '_wp_attachment_image_alt', true ); // No ALT supplied get attachment info if ( empty( $thumb_alt ...
1
vote
0answers
14 views

Is it possible to use Data URI image to set a post thumbnail?

I have a custom template I am setting up on a site that generates an image in canvas to go along with the post in Data URI format, and allows me to save it as jpg/png. However, would like these images ...
1
vote
3answers
41 views

WP Post-Thumbnail

I've already saw the question some times here, but sadly nothing helped me out yet. Right now I've got following code: <h2 class="title_bar">Videos</h2> <ul class="vlist&...
1
vote
0answers
36 views

Set Featured Image by URL Form Post

How do I append a form URL to set as my featured image? I am working on a user frontend submission site that is pretty basic and using WP User Frontend Plugin. I finally figured out the GIF URL ...
1
vote
0answers
14 views

Set size for attachments

I am working on a custom theme and have generated content with FakerPress to include some uploaded post images. I want to ensure any image uploaded as an attachment in a post displays in one of the ...
1
vote
0answers
22 views

How to stop thumbnail generation from some images and different size thumbnail generate

I have 4 Post Type, and each Post Type has images with different size. Is it possible to choose not to create thumbnail images when uploading an image or to create specific images size for each post ...
1
vote
0answers
33 views

Can you put a condition on add_image_size() depending on the width of the uploaded image?

I just started to optimize the auto-scaling of images i upload on my wordpress (via Media tool). I added the desired set of custom sizes, which are working just fine. In example : add_image_size( 'og'...
1
vote
0answers
36 views

Update old Post image metadata to 'thumbnail' wp_attached_file

I am updating a very old WP-based website that was created prior to WP use of "featured images" aka thumbnails and the name of all post images are contained in a custom meta-field called "Image" (...
1
vote
0answers
20 views

Featured image for product listings, but another image as the product image?

I want to show a different image of products listing on the home page of the site, not the featured image but when customers click on the products then it should show the featured image on the product ...
1
vote
0answers
150 views

Attach Thumbnail Generated from Video Upload as Featured Image for the Video

I have a custom post type "Videos" where multiple video files can be uploaded. I need to generate a thumbnail for each of these uploaded videos and attach these thumbnails as "featured image" for the ...
1
vote
1answer
94 views

How to stop wordpress always displaying full-res images

Currently, my website is over 56mb just on the home page... I have 5 images, it's far too large and is killing the speed. Is there a way to make my site only display thumbnails or is this always ...
1
vote
0answers
129 views

Set featured image using javascript in post editor

I have built a plugin that will auto-generate an image based on some variables in the post the user is writing. They have the ability then to set some colors and stuff to make the image look nice. ...
1
vote
1answer
66 views

Including post thumbnail url in loop's post object to reduce number of queries

I'm working now on high performance Wordpress website and it requires me to analyze a lot of queries, caching options etc. I've discovered that if you use get_the_post_thumbnail() even within the loop,...
1
vote
1answer
435 views

How can I add a “data-pin-nopin” the featured image html?

I really want to prevent my featured images from being pinned. It seems so simple but I just don't have the knowledge to do it apprently. I found this but it doesn't work. I have divi theme if that ...
1
vote
2answers
461 views

How to find post with broken image link and delete that post

I have some post in my autoblog that by cronjob mistake the feautured image being deleted. how to find all of that post (post with broken image link) and delete all of it or set the default image if ...
1
vote
1answer
76 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-...
1
vote
0answers
363 views

Using Featured Image as Hero Background

I'm trying to create a user-friendly way to choose a hero image AND leave the ability to edit a text overlay in the same div. Here's the problem: A. Featured image code is php, and in the template. ...
1
vote
0answers
527 views

how to link post-thumbnail to original img in a lightbox?

I have a page showing custom post type, but I don't know how to link to the full size image that can be opened by a lightbox plugin. the post page is like: <div class="content" id="main-content"...
1
vote
1answer
2k views

How to add custom label or texts in featured image

I have tried to add custom title or hint text inside the featured image box in Worpress custom taxonomy. but didn't get the solution. how to add a custom text underneath of the Click the image to edit ...
1
vote
2answers
4k views

Woocommerce featured image of page - not product

I have a custom theme in which I have a woocommerce.php file to display the shop homepage. This is simply: get_header(); ?> <div id="primary" class="content-area"> <main id="main" ...
1
vote
1answer
197 views

Adding Images into API

I'm trying to add featured images to my API but it's a different type of post. http://example.com/wp-json/wp/v2/directory I have been using WP REST API Controller but it doesn't show image option. ...
1
vote
1answer
107 views

how i can add title to my featured image?

I want to add a title to my featured image, how I can add this item: $attr = array( 'title' => 'howdy partner', 'alt' => 'a nice view of the ocean', ); // pick one, note 2 or 3 ...
1
vote
2answers
1k views

WooCommerce Base Page Featured Image Custom Theme

I have a very basic theme that is running WooCommerce beautifully so far. In my functions.php I've setup the following to support woocommerce. // // WooCommerce Hooks and Theme Overrides // ...
1
vote
0answers
181 views

WP keeps looking up post thumbnail on https even though wp-config says http

In wp-config.php I set: define('WP_CONTENT_URL', 'http://cdn.example.com/wp'); but WP's get_the_post_thumbnail_url keeps looking up static content on https://cdn.example.com. In the admin, it's all ...
1
vote
0answers
174 views

Stuck on save/upload featured images plugin

Im stuck on save/uploading Featured Images. I want to upload my featured image but it give an error: An error occurred in the upload. Please try again later. Can anyone see what is wrong? And if you ...
1
vote
1answer
42 views

2 image size for post

I have servel image sizes in my post, all under 2 proportion: square and rectangle. for example square :100X100, 200X200 rectangle: 300X100, 600X200 Via ACF I created new image upload file so I ...
1
vote
0answers
487 views

Notice: Trying to get property of non-object when trying to get thumbnail URL

I'm trying to get the image url of a post thumbnail, but I'm receiving an error now and I think a couple of months ago, this code used to work. I'm using $url = wp_get_attachment_url( ...

1
2 3 4 5
9