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
0answers
23 views

Put featured image under post title in admin area

Instead of inserting a new column with a featured image on it, I would like to put the featured image under the post's already existing title. I can't seem to figure out how you insert things on the ...
0
votes
0answers
18 views

How to only show div of caption if caption exists on featured image

I am trying to only show image captions on featured images. However, if the image does not have a caption, I do not want it to show the <figcaption> tag. I have added the following code to my ...
0
votes
0answers
17 views

Delete media from the post but keep my featured image and post

I have a lot of posts on my news site, I have a problem with space, I would like for posts older than three months, to delete the images that are in the post, but to keep the featured images and the ...
1
vote
1answer
40 views

wp_get_attachment_image function size argument not working if I also add a custom class

I'm trying to output some images the right way, using the wp_get_attachment_image function. Here's how I do it: echo wp_get_attachment_image( $image_id, 'image-size', '', [ 'class' => 'some-class' )...
0
votes
1answer
25 views

How to use SRCSET with get_the_post_thumbnail()?

My wordpress theme uses get_the_post_thumbnail() to display Thumbnails on Posts. I have set custom image sizes but running it through Lighthouse gives following error. Serves images with low ...
1
vote
0answers
28 views

Wordpress auto generates small medium and large of an image on upload, how can we guess their links?

WordPress out of the box has an integrated image sizes system, which creates files ( thumbnail, S, M, L) but in the media library, it only shows one original file size link. Let's say, I upload a file ...
0
votes
0answers
10 views

Add a Call to Action Button to Wordpress Post Thumbnail

I would like to add a call to action button directly beneath the Post Thumbnail on the single post, using Advanced Custom Fields data, using either an action or a filter (not sure which would be most ...
0
votes
0answers
19 views

images destroyed after using wp_get_image_editor

this is a really weird problem. i use wp_get_image_editor to resize my original featured images and save it and display on my website. after uploading and using it as featured image, most of time the ...
0
votes
0answers
18 views

Look for image by class and set as featured image bulk

I'm new here and I have zero knowledge of coding so I hope you can help me. I migrated an old website to new wordpress one and used a plugins to set first image of posts as featured image. but ...
0
votes
0answers
11 views

Move Featured Image upload field into other meta box in custom post type

add_action('admin_menu', 'st_series_cpt_add_box'); function st_series_cpt_add_box() { global $fichead_meta_box; if( current_user_can('editor') || current_user_can('administrator') ) { ...
0
votes
0answers
81 views

Add Featured Image to Existing Post

I have already created thousands of product as posts (CSV Import). They have a custom post type. Now, I would like to assign featured image to each existing post programmatically (without manually ...
2
votes
0answers
65 views

Regenerate thumbnails unexpected resolution (96 x 96)

I'm using WP CLI wp media regenerate to resize my thumbnails. I've noticed something a bit weird. The original image I upload is a JPEG with a resolution (DPI) of 72. The images that are generated ...
2
votes
1answer
21 views

Does thumbnail regeneration edit the database?

I'm using the WP CLI command wp media regenerate to resize all of the images via the /wp-content/uploads directory. Are the new image dimensions registered in the database in any way or does the ...
0
votes
1answer
23 views

Add class to custom thumbnail

To generate a thumbnail for certain part of my theme i'm using the following code : if(has_post_thumbnail() && !post_password_required() && !is_attachment() && ...
0
votes
0answers
29 views

How to change Gallery image url in product page ? In function.php?

My code is like add_filter('wp_get_attachment_url', function($url){ if(strstr($_SERVER['HTTP_ACCEPT'], 'image/webp')!=false){ return $url.".webp"; }else{ return $url; ...
0
votes
0answers
8 views

Featured images have disappeared in the Trending section only of my website

I just now noticed this appears above the Featured and Trending options at the bottom of the Edit Post page. I really don't think it was there all along. Could it be the problem? Can you suggest what ...
0
votes
0answers
25 views

how to use featured image as full width post banner in single post template

how to use post featured image as full width post banner in single post template. Also i want to hide default post banner in wordpress . I am using generatepress theme , Title , meta Over Full Width ...
1
vote
1answer
58 views

How do I set "Upload Image" as detault "Set Featured Image" window?

We have few WordPress sites with custom themes where new posts are added very frequently (more than 200 posts a day) so we are trying to be as efficient as possible. I tried to google for a solution ...
0
votes
1answer
37 views

wp_query - Exclude the first thumbnail from lazy loading on archives

I have a function that change loading="lazy" to loading="eager" from the first thumbnail in categories and tags. The problem is that this function removes the post thumbnails from ...
0
votes
0answers
16 views

Random featured image in folder with twenty twenty tempalte cover

For one of my wordpress site on a child theme of twenty twenty, I would like to randomly display a featured image (pre-selected in a folder) which changes with each load eg of the page. I succeeded in ...
0
votes
0answers
29 views

Using the admin Featured Image's modal in the front end

I am trying to get the new upload frame of the featured image used in the admin side, but the one used in the front is different. I will show you some screenshots: In the admin section when I click ...
0
votes
1answer
28 views

Which filter fires upon setting a featured image

When I am creating/editing a post and set the featured image, I’d like to display a message to the screen if the file dimensions or size are below a certain threshold. But I want the featured image ...
1
vote
1answer
41 views

Setting fallback (default) image to featured image block

I was trying to make a block based theme and encountered a problem trying to set a default featured image in case some posts do not have them. Basically, we used to do this in php <?php if ( ...
0
votes
0answers
24 views

insert og image link in wordpress post

I am trying to extraxct the og:image url is there a wordpress plugin that extract og:image url from an external webpage url i need a shortcode to insert that image in my post
0
votes
2answers
27 views

Thumbnail is showing outside its div instead of inside it

I'm echoing the post thumbnail here: echo '<div class="post-image right">' . the_post_thumbnail('featured-portrait-large') . '</div>'; And it works, but it's outputting the ...
-1
votes
2answers
398 views

WP is showing wrong image dimensions

Several times over time I changed sizes of thumbnails WP generate when images are uploaded, always setting bigger size. Recently I set Thumbnail Width 600px width and Medium size Max Width 1800px. ...
0
votes
1answer
41 views

Recent posts on homepage: different thumbnail based on logged in status and post category

This works well on archive.php, but not working on the homepage. For some reason, the first statement doesn't get applied: if a post is in Members category and user is not logged in, it's supposed to ...
1
vote
1answer
21 views

Featured Images Not Loading In Blog Archives

A client running a custom theme recently updated their WordPress version from 5.2.7 to 5.7.1. After this update, featured images in blog archives are no longer loading. The theme has been updated to ...
0
votes
1answer
56 views

Display related posts without a plugin

I'm trying to display the related posts using functions.php: function posts_related($related){ if (is_single()) { global $post; // Build basic custom query arguments $custom_query = new WP_Query( ...
0
votes
0answers
16 views

Show categories when upload a featured image

When you upload an image in the media library, you can add categories in the process. Is it possible to show categories when you are editing a post and add a feature image. In this case, when you ...
0
votes
0answers
14 views

Default Featured Image only shows on single post page

so I would like to set a default Post featured image / thumbnail. I tried using this code in the post loop in the loop.index, but that only showed the default image in the single post pages and not on ...
0
votes
1answer
25 views

default post thumbnail and category if there is no thumbnail and category

I want to do following... 1 - Publish the new post, 2 - Check if this new post has a featured image, 3 - If it has not a featured image, define its category and save the specific prepared image as the ...
0
votes
1answer
107 views

get_the_post_thumbnail_url does not return anything if image size is set

I want to display the post-thumbnail image in the header using get_the_post_thumbnail_url() with defined size, however if I am using it without specifying the size, like get_the_post_thumbnail_url() ...
0
votes
1answer
85 views

<?php the_post_thumbnail_url('medium'); ?> not outputting medium size image URL

I am currently trying to output post thumbnail URL with its different image sizes; to use in ssrcset. My current code is: <img class="productimage lazyload" data-src="<?php ...
0
votes
0answers
10 views

How to set the featured image / page thumbnail from php template?

I added a template php to my Wordpress site, showing a basketball image from url, I'd like this to be the thumbnail of my website when sharing on social media My php template- <?php /* *...
0
votes
1answer
47 views

How to add a default predefined thumbnail when creating a brand new post?

I'm making a plugin that has a custom post type and I need to add predefined content. I used filters default_title and default_content for the title and content but I can't find how I can add an ...
0
votes
0answers
37 views

Change featured image lightbox image size to full size

So i made a blog with posts with image galleries, and i would like to make the featured image lightbox full size instead of the smaller size it is now. I already did this with the images in the ...
0
votes
0answers
15 views

Display Author avatar as featured image

Does anyone know how I can display the post author avatar as the default featured image for posts? Thank you
0
votes
0answers
12 views

How would I center the featured image position on a post?

The featured image us left aligned and not centered, and on mobile view does not look good. How can I customize the way the featured image banner looks?
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 ...
0
votes
2answers
177 views

PHP variable = get_the_post_thumbnail_url outputting without slashes

In a custom shortcode function, I'm grabbing the featured image URL: $text_slider_testimonial_img = get_the_post_thumbnail_url($single->ID); If I echo $text_slider_testimonial_img immediately I ...
0
votes
1answer
25 views

Blog replace single post page featured image

i made a blog and now i want to fix the issue if somebody doesn't add an image to use as the thumbnail, I want to use a default image. I did find a plugin that fixes that, but i would like to change ...
1
vote
0answers
21 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 ...
0
votes
1answer
92 views

wp_get_attachment_url not fetching URL?

the below code does not seem to return an image url at all, chrome inspector says source is unknown foreach ($subcategories as $subcategory) { $link = get_term_link( $subcategory->...
0
votes
0answers
21 views

How to change the featured image / post thumbnail size on category / archive pages?

I am trying to figure out how I can change the size of the featured images on category and archive pages on my WordPress website using a custom theme. In my functions.php file, I have added the ...
0
votes
0answers
35 views

Resize thumbnail in elementor hello theme

Absolute beginner, need help trying to resize my thumbnails in elementor hello theme. Elementor say its a theme issue, yet its their theme ! I have tried css custom codes to no avail.
0
votes
1answer
19 views

Removing extra large generated images disables all crops

function filter_image_sizes( $sizes) { unset( $sizes['1536x1536']); // disable 2x medium-large size unset( $sizes['2048x2048']); // disable 2x large size return $sizes; } add_filter('...
0
votes
0answers
18 views

Generate thumbnails with HTML overlay with PHP

I want to generate sosial media image with an HTML overlay. So in simple terms JPEG thumbnail + HTML overlay = JPEG output. Example, I have an light image without text on it, then I add an dark ...
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:
0
votes
0answers
17 views

Thumbnail (featured image) and Media Library cleanup queries help needed

I inherited a website that was started 13 years ago, over the years the version of WP and themes have been kept current, however much of the older content (and there is a ton of it) was created long ...

1
2 3 4 5
32