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
0
votes
2answers
8 views

How to use get_the_title with text on the 'alt' of the_thumbnail array?

I'm currently using <?php the_post_thumbnail('250px', array('class'=>"review-siteshot", 'alt' => get_the_title() )); ?> I know that 'alt' => "review" will output review as all text. I'...
0
votes
1answer
15 views

featured image background

trying to create a shortcode in funtions.php to show a featured post.. Everything I have works fine except I can't get the background-image to show the post's featured image... echo $...
-1
votes
0answers
19 views

How to display video thumbnails in wordpress for external sites (not tube sites)

I have been looking for several hours a way to display video thumbnails from external sites into a post, Scenario: I have got a excelfile(CSV) that contains thousands of lines where each line is a ...
1
vote
1answer
43 views

How to retrieve the post featured image (thumbnail) ID in Gutenberg blocks?

WordPress (PHP) has a lot of functionality to retrieve the post featured image (post thumbnails). However I can't find easy ways to retrieve the post featured image in a dynamic block. Using PHP: ...
0
votes
1answer
17 views

Admin Notices don't display on the admin screen for certain post

I want to make a featured image required. For starters i am trying to show an error message after update or post buttons are pressed. The problem is that the notices which i try to include don't show ...
0
votes
0answers
8 views

Store Featured Image in base64 string for Restful API

I am using WordPress' default REST API for posts. The app also needs images as base64 string. For this, I convert featured image to base64 on the fly. For example, in an API call, 10 posts are being ...
0
votes
1answer
15 views

How do I run an action after a featured image has been selected in the Gutenberg editor?

I have found a few tutorials such as a DigitalApps.co and That Dev Girl explaining how to use "wp.hooks.addFilter( 'editor.PostFeaturedImage'"... in order to create/replace the content of the featured ...
0
votes
1answer
52 views

get_the_post_thumbnail() produces different HTML on same arguments

I am trying to display the featured image of the first post in the respective archive of the tag page. The template I am using is twentyseventeen. I already see the image by inserting the following ...
0
votes
0answers
11 views

Why is this plugin throwing a 404 and not finding the Javascript file on Wordpress 5.1.1?

I found this plugin that is supposed to require a featured image in order for an admin user to 'publish' to Wordpress. However, when I run the plugin in my localhost environment, I get a 404 error for ...
0
votes
2answers
22 views

adding additional class to get the post thumbnail [duplicate]

I'm just starting to create new theme and i'm new to code. I'm stuck in customizing the post thumbnail code, i tried add <?php previous_post_link(get_the_post_thumbnail(get_previous_post(), array(...
0
votes
0answers
25 views

Image alt attribute

My images have alt attribute, but is not showing. My SEO pluging does not recognized them and google prensets the an alt text that is not the one I wrote but the name of the picture(file). this is how ...
0
votes
1answer
29 views

Show Post Thumbnail In Custom Post From Other CPT

I have a 'Match' CPT to create posts for each game played by a football team. These posts display details of the opposition team by pulling through information from the appropriate post from another ...
0
votes
1answer
29 views

Function to replace the url of featured images in the wordpress database?

Sometime ago I uploaded all images of my wordpress installation to the /media/ folder. So urls where something like this: http://example.com/media/featured-image-2010.jpg This folder is very, very ...
0
votes
0answers
10 views

Attaching image to an existing post programatically, the attached file is blank

Attaching image to an existing post programatically, the file gets attached to the posts in the array but it does not end up as an image, its a blank file. Got the code from the wordpress codex: https:...
0
votes
1answer
19 views

How to set featured image from external url programmatically

I have already read https://stackoverflow.com/questions/41524931/how-to-set-featured-image-programmatically-from-url and that's not the answer to my question. The above answer will download the image ...
0
votes
0answers
33 views

Trouble adding custom featured image for custom taxonomy TERMS

Wordpress version 5.2.2 Local development - WAMP PHP version 7.0.1 I am building car dealership website. Goal: Set featured image for custom taxonomy - Body Types Set featured image for custom ...
0
votes
0answers
10 views

Change Set Featured Image button behaviour

How can we chage Set Featured Image Button behavior, so that it will work as Add Media button, which show other option on left sidebar
0
votes
1answer
30 views

How to automatically add first image of post as thumbnail?

Lot of subject talk about it but seem to be outdated. I use the new version of Wordpress (5.2.2), and no plugin or code snippet working. Someone already has this problem ? I already use plugin the ...
0
votes
1answer
23 views

Add a default style if no Featured image is selected

How do I have a fallback CSS style if no featured image is selected in WordPress? I'd rather remove the featured image block and replace with some CSS class if nothing is selected. <?php $thumb = ...
0
votes
1answer
21 views

Image doesn't show up using get_the_post_thumbnail_url();

I have a simple question. My wordpress theme has 2 pages: index.php and single.php. I've used the same code, but I had different results. single.php <?php while(have_posts()) { the_post(); ?...
0
votes
1answer
17 views

why get_the_post_thumbnail( the_ID()) echos extra post id

I have the following snippet which adds post thumbnails to products on archive page if matches a given product category, which will output the image but echos the the post id as well. How do I ...
0
votes
0answers
18 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. ...
0
votes
1answer
11 views

Thumbnails are hard cropped not matter what

I'm using WP Job Manager, and would like user-uploaded logos to be resized and positioned to fit within a fixed height and width. Currently, my settings are at: When I am uploading the following ...
0
votes
0answers
25 views

RSS media:content image to Featured Image

I can see lots of plugins and solutions for embedding a featured image into an RSS feed, but what I want to do is take an image that has been embedded in a feed and make it a featured image when the ...
1
vote
1answer
26 views

How check that there is post thumbnail feature image or not on wordpress?

On my wordpress site , I have some post that all of them have post thumbnail, but their post thumbnail removed from host and now when i want to load them on site , there is no image for loading to ...
0
votes
1answer
24 views

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

I want to link featured images of every WordPress posts to specific page/url for only visitors (non-logged in members). And this function should be disabled for logged in users. It should only link ...
0
votes
2answers
25 views

Images are randomy deleted from server

I've got a bizarre problem with a website I'm working on. Recently, when anyone uploads images to the site, some time later (maybe an hour, sometimes several hours) one or more images disappear ...
0
votes
0answers
21 views

wp_get_attachment_image_srcset returns false for CPT

I have created a CPT function create_themes_posttype_raihan() { register_post_type( 'themes', // CPT Options array( 'labels' => array( 'name' => __(...
0
votes
0answers
17 views

WordPress on CentOS automatically generate featured image 300x300 , but WordPress on Windows keep original image size

I am using WordPress 4.6 , WooCommerce . WordPress on CentOS automatically generate featured image 300x300 , but WordPress on Windows keep original image size. Same source code, on CentOS 7 on ...
0
votes
0answers
44 views

Thumbnails regenerate wp_generate_attachment_metadata

I'm importin pictures via FTP and create custom recorss in mySQL via insert. I'm trying to make a cron job to regenerate thumbnails. This is what i came up to.. but i doesnt work. add_action( '...
0
votes
1answer
30 views

All Images not calling alt text

I am having trouble with the alt text on my wordpress.com website. I am using a theme I coded myself. From what I recall, if I added alt text to an image in the Media Library it would insert into the ...
0
votes
1answer
21 views

Issue with wordpress thumnails - same thumnail displayed everywhere

I have this piece of code <?php $loop = new WP_Query(array('post__not_in' => array($latestId),'post_type' => 'post', 'posts_per_page' => 9,'paged' => ( ...
1
vote
1answer
19 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
votes
1answer
24 views

Show thumbnails 1-12 of category x on any given page

Using wordpress twenty nineteen, I checked the forum but cant find this same question. I would like to display the 12 most recent posts from category x, using just a thumbnail of the featured image ...
0
votes
1answer
32 views

display WP image posts in Bootstrap 4 modal

I have a series of image posts displayed on a page of a WP site that uses Bootstrap 4 _ The link to the development site is also online here The images normally display in a larger size when they're ...
0
votes
0answers
11 views

How can I hook to the thumbnail creation function and create an additional image in other folder?

I need to create the "retina" image with 2x width of each existing image in the folder "uploads" to the folder uploads/scaled. like this: image_resize( string $file, int $max_w, int $max_h, bool $...
0
votes
0answers
15 views

Featured image size always cropped bottom

Good day! I am trying to add a featured image to my post but every time I add a featured image, the lower part gets cut off. Original size is 300x300 pixels. If the windows size gets changed, ...
0
votes
1answer
33 views

How enter custom post meta or custom field on box post list archive page?

I ask a question that I think many people are interested in knowing the answer. What I really can't do with wordpress is to insert custom meta or dynamic custom fields into the post boxes (on the ...
0
votes
1answer
37 views

WordPress set featured image to first image of the post

I have tried every solution from similar answers and nothing seems to work on Wordpress 5.0 + When saving a post I want to set its featured image to the first image in the post content. function ...
0
votes
2answers
146 views

Fallback default image when there is no featured image

I have tried many options but without luck. It should be very simple approach but does not produce results. I am trying to insert default fallback image if there is no featured image in the post. My ...
1
vote
1answer
21 views

Create thumbnail size only for a few images?

I have a few posts that require their thumbnail sizes to be 1000x430. If I register this size and regenerate the thumbnails, it will create this size for all images in the media folder, if I'm not ...
0
votes
1answer
42 views

Using featured image of blog archive page

On my custom wordpress theme, I am using the featured image thumbnail for all of my pages to be the header of the page. I've created a page called "blog" and using it as the archive ( via settings ->...
0
votes
0answers
18 views

Multiple Post Thumbnails Not Returning URL for Background Image

I've been using the Multiple Post Thumbnail plugin with my custom post types to use a secondary, smaller image on my archive pages, while I have a larger hero image in the header of the single post (...
0
votes
1answer
45 views

Remove Featured Image & All Media Uploaded to the Post

I found a solution of removing featured image related to the post when delete the post from this article but, I want to remove all the uploaded media also with post removing. Delete all WP image ...
-1
votes
1answer
16 views

Auto post creation

I've a problem in wordpress that I find automatic posts getting created.. I couldnt figure out what is causing that.. Is this can be from a plugin? You can see in the picture an example of those posts ...
0
votes
0answers
60 views

How to programmatically set existing image in media library the featured image for a post in wordpress

I have uploaded some images to the wordpress media library. Now I am going to create some posts using php and want to use those already uploaded images as featured image for these posts respectively. ...
1
vote
1answer
66 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 ...
0
votes
0answers
21 views

Smush Featured image constraining in image file that is being loaded on page

I added Smush - what a mistake. Somewhere, it is changing which image is being loaded in the featured image spot, not by image compression but by loading the appending 1024x768.jpg string to the image ...
1
vote
1answer
186 views

Change WordPress image URLs via filter

I'm planning to create a wordpress plugin that will offload uploaded images to external website and show them from there. What I did so far: 1) Whenever a images gets uploaded, my custom functions ...
0
votes
1answer
19 views

how to post default thumbnail if post not created yet

I want to show a default thumbnail if a custom post not created yet. Here is my loop: <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <?php if ( ...