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
1answer
682 views

Can I get thumbnail of taxonomy?

<?php $args = array( 'type' => 'itineraries', 'child_of' => 0, 'parent' => ...
0
votes
1answer
363 views

Hide Featured Image in AMP

We are using the "Official AMP plugin" by AMP Project Contributors. Our posts tend to have an image inserted at the top. Sometimes this is creating a duplication with the Featured Image. How do I ...
0
votes
2answers
35 views

replace featured image from frontend

I'm using this code to add the alt text to my featured images on upload. $image_title = get_post( $post->ID )->post_title; // Sanitize the title: remove hyphens, underscores & extra spaces:...
0
votes
0answers
49 views

Wordpress create thumbnails on demand

I am having a problem with my hosting as there are too many files in it. This is basically because of wordpress creating thumbnails for every image uploaded and this has accumulated over the last 3 ...
0
votes
1answer
48 views

Distinguish between page and post in function

I'm trying to apply some text to the "Featured Image" box. It works fine for a custom post type, but I can't get a specific piece of text appearing on pages rather than posts. add_filter( '...
1
vote
2answers
81 views

post thumbnail not showing up with shortcode

I have created a shortcode with this code: add_shortcode('recent-newsletter', 'recent_newsletter'); function recent_newsletter() { $recentnews = new WP_Query(array( 'post_type' => '...
0
votes
1answer
23 views

Can You Set A Minimum Image Dimension For Resizing Images?

This seems like a simple request but I can't find how to do it anywhere. Using add_image_size you can designate maximum width and/or height for an image to be cropped or rescaled but I can't find how ...
1
vote
1answer
17 views

How to handle and keep image quality of featured image uploads

My idea is to use the uploaded thumbnail/featured image from the post as a image with the height of 750px and 100% width of the page on my page. Everything is working fine however the image quality ...
2
votes
1answer
100 views

Get Ancestor featured image

I've been trying to get the ancestors post ID to show its featured image on all sub pages, but I can only ever get combinations that work as top level and sub page, never a third page down. The setup ...
0
votes
0answers
8 views

Thumbnails and images in the blog post are not loading

I have a blog that has many images in it. Recently I encountered an issue that the images in the blog posts do not load if I refresh it after a while. This is the same with the thumbnail as well. What ...
0
votes
1answer
30 views

Wordpress generate images size after upload

I use this code for upload image : function Generate_Featured_Image( $image_url, $post_id ){ $upload_dir = wp_upload_dir(); $image_data = file_get_contents($image_url); $filename = ...
0
votes
2answers
671 views

How to set minimum required size for featured image?

I would like to set minimum required size for featured image. I want to prevent using images smaller than the featured image size, because otherwise some images can be displayed improperly. For ...
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 ...
0
votes
1answer
69 views

how to give multiple post thumbnails to a post

the image with the red cercles are the post thumbnail images, i want to give each post an image of size 100px X 60px, i dont know how to make it, this will make the website faster , becease it will ...
0
votes
2answers
89 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
28 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
vote
1answer
2k 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
609 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
1answer
172 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
138 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
2answers
67 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
304 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
350 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 ...
1
vote
1answer
235 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
1answer
1k 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
62 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
1answer
55 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
86 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
450 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
31 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 ...
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. ...
0
votes
1answer
191 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 ...
1
vote
1answer
63 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
26 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 ...
1
vote
3answers
768 views

Images are randomly 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 from ...
0
votes
0answers
91 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
388 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
22 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
65 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
682 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
17 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, ...
-1
votes
2answers
925 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
94 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
3answers
2k 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
34 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
1k 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
106 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
839 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 2 3
4
5
32