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

Is there a best practice remediation for PhpStorm's warning that void function the_post_thumbnail is used?

In a plugin I'm working on there is a line: echo the_post_thumbnail(array(155,55)); It throws a inspection warning: 'void' function 'the_post_thumbnail' result used Is there a best practice ...
davemackey's user avatar
2 votes
1 answer
299 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 ...
HAL2020's user avatar
  • 39
2 votes
0 answers
563 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 ...
Edwin Snotje's user avatar
2 votes
1 answer
958 views

Featured Image .svg height and width 1px only

I need to create a custom type post where will be added the name of the client and its logo. The logo will be added as a Featured Image. But the problem is that WordPress does not recognize the SVG ...
danihazler's user avatar
0 votes
0 answers
680 views

How to delete original image file after upload and resize [duplicate]

When I upload an image named image.jpg, Wordpress creates image-150x150.jpg. How can I delete image.jpg and keep just the image-150x150.jpg in function.php, because I want to optimize my disk space ...
tientruong0810's user avatar
1 vote
2 answers
3k views

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren't ...
Andrew's user avatar
  • 189
0 votes
0 answers
82 views

attachment_fields_to_save first parameter is null

I have the following code in a self-written plugin. In the function saveHomepageGalleryCheckbox the first param ($post) is always null. Did I something wrong? The second parameter ($attachment) has ...
sydev's user avatar
  • 123
0 votes
0 answers
33 views

How to exclude 150*150 Image to set as a thumbnail?

The size of the first image of each post of the feed that I am importing is 150*150. Theme always set first image as feature images so the all thumbnails are looking blurry. Is there any custom css or ...
RGM7's user avatar
  • 13
0 votes
2 answers
2k views

cropping post thumbnail without falsing them to crop to dimensions

am trying to crop my thumbnail in my loop, am having some problems when i crop using codes some images appear either big in width or height here is my code Css .imgholder {float:left;margin-right:...
Mulusa Pro's user avatar
0 votes
3 answers
226 views

Should I not compress my jpeg files before uploading to avoid double compression?

Wordpress compresses jpeg files to a lvl 82 quality. Should I upload my files in 100 quality to avoid double compression? Or will Wordpress know the file is already compressed and will skip this ...
ClawDuda's user avatar
  • 141
0 votes
2 answers
66 views

How to add Wordpress Featured image in <a> tag ..?

I am trying to add Wordpress featured image in tag. I used these 3 shortcodes. <?php echo $image_large[0]; ?> <?php echo get_the_post_thumbnail(null,'thumbnail');?> <?php echo ...
user2996362's user avatar
0 votes
1 answer
604 views

Set featured image as hero image on each page

I want my post's featured image show as a full width hero image. I have tried to set the featured images as background images in a full-width row, but I think it is not possible. If anyone have the ...
Suman M's user avatar
0 votes
1 answer
1k views

Get featured image from post on RSS feed

I want to add the featured image to my RSS feed. function rss_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<p>' . ...
LovinQuaQua's user avatar
0 votes
1 answer
898 views

automatically set random featured image by category in wordpress on post

Basically I want to automatically set an image randomly from a selection of about 3 or 4 images in my Media Library when someone posts a blog from a particular category. I've got this so far but it ...
Stefan Gassner's user avatar
0 votes
2 answers
31 views

Custom recent-posts shortcode's thumbnail image not in line with rest of code

I'm making a custom recent-posts shortcode and I have a problem with the thumbnail image, it always shows it above everything else (permalink, title, etc...) even though I put it after in the code, is ...
Alex Mattelon's user avatar
0 votes
1 answer
460 views

How to display featured image description and title?

I'm displaying a featured image (as a background) in a hero div, and using the caption to add some content from the Media Library automatically. I'd also like to use the image's description field and ...
GodWords's user avatar
0 votes
2 answers
31 views

An error has occurred during the upload process in wordpress version 5.3.2

I need your help , i try upload to wordpress an image but there is error ‘An error has occurred during the upload process in wordpress’ , please help me find solution. ASAP Note : this website http://...
Sri Kartini's user avatar
1 vote
0 answers
34 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 ...
omid chahardoli's user avatar
0 votes
2 answers
219 views

Generate images to be associated for tag and category?

I’d like to generate images suitable to insert into metadata (like Open Graph or twitter:image). Basically I want to create a collage based on posts for each tag. So let’s say I had the tag “cats” ...
artlung's user avatar
  • 3,087
1 vote
0 answers
43 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'...
abicatian's user avatar
0 votes
1 answer
1k views

Import 2000 posts from one website to another

I need to import 2000 posts from one website to another. Posts doesn't have any custom fields. We need to import title, content, featured image, slug and language. For language I am using Polylang ...
edonbajrami's user avatar
1 vote
0 answers
222 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" (...
Trisha's user avatar
  • 418
0 votes
1 answer
26 views

How to show Thumbnail size, caption, extension in WordPress?

How to show Thumbnail size, caption, extension in WordPress??
SauRav's user avatar
  • 5
1 vote
1 answer
327 views

Add post-thumbnail after first paragraph including the caption

The function below is used to show the post thumbnail after the first paragraph. add_filter( 'the_content', 'insert_featured_image', 20 ); function insert_featured_image( $content ) { global $post;...
lefty's user avatar
  • 15
0 votes
1 answer
61 views

How can I make thumbnails a display different size/position if the blog post was posted before a specific date?

I would like to be able to display the blog post's thumbnail a smaller size and right floated if it was posted before April 11, 2019 but I can't seem to figure it out. This is what I tried: <?php ...
Brenda Carey's user avatar
0 votes
1 answer
227 views

How to add animation the featured image?

By default I choose featured image from media library. When I hover over each, It shows a black overlay with a plus sign. I have a cool css animation and want to add it to each post featured image. ...
Ashur's user avatar
  • 23
0 votes
1 answer
31 views

Show thumbnail depending on image width

I'm trying to display the images in Landscape or Portrait mode depending on the width of the image I upload to the "featured image" of each WordPress article. If the width of the image is greater ...
Mike's user avatar
  • 1
0 votes
0 answers
49 views

Force WordPress to always generate a thumbnail for original image

WordPress only generates thumbnails for sizes smaller than the original image. However sometimes the user will upload an uncompressed image with dimensions below the specified thumbnail size e.g. ...
John Nicolson's user avatar
1 vote
1 answer
728 views

Can't check if a post has thumbnail adding filter to get_post_metadata()

I need to set fake thumbnails to all posts which have yet no a thumbnail. I use the code from the link core.trac.wordpress.org/ticket/40547#comment:1 But I can't check if a post already has a ...
stckvrw's user avatar
  • 285
0 votes
0 answers
48 views

Show featured image in all posts

I use the Uncode theme which allows me to place my featured image in the posts, however it only shows me those that have a large image (approximately over 1500 wide) and the small images do not show ...
Gerardo Rios's user avatar
1 vote
1 answer
965 views

Frontend Post - Allow Only Image File Upload

How I can allow user to upload only IMAGE file ? function.php // Insert Attachment function insert_attachment($file_handler, $post_id, $setthumb='false') { if ($_FILES[$file_handler]['error'] !==...
mems's user avatar
  • 73
0 votes
1 answer
600 views

Gutenberg featured image checkbox - checkbox not correctly set on editing page reload

I've followed a tutorial to get a checkbox displaying under the featured image of a post that is being edited using Gutenberg. It's a checkbox to allow the editor to control whether to display the ...
Hannah Smith's user avatar
-1 votes
1 answer
960 views

Get post thumbnail in specific size

$image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_id() ), 'images_posts' ); This code shows Post Images in the original size, but I want to show thumbnail in 160x213 pixel that I ...
adam sk's user avatar
10 votes
3 answers
8k views

WordPress adding scaled images that don't exist (1536x1536 and 2048x2048)

I'm building a theme in _S and using native Gutenberg blocks. I have the following code via my functions.php file to set my image sizes: add_theme_support( 'post-thumbnails' ); add_image_size( '...
Sam's user avatar
  • 2,106
1 vote
0 answers
34 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 ...
Ithedev's user avatar
  • 11
0 votes
1 answer
386 views

Wordpress 5: including larger thumbnail image sizes in srcset than I have set

I have set image sizes in my functions.php, such as add_image_size( 'article-lede', 500, 600 ); It shows up in Regenerate Thumbnails, and I regenerated them. So I upload an image to the media ...
Steve's user avatar
  • 293
2 votes
1 answer
1k views

Disable wordpress image sizes generation

I'm trying to disable image sizes generation in wordpress. When I use: print_r( get_intermediate_image_sizes() ); it shows: Array ( [0] => thumbnail [1] => medium [2] => ...
Matredok's user avatar
1 vote
1 answer
2k views

WordPress reduces the full size image and uses it as the original

A few days ago I have a problem. I use a 3600x2500px images. After upload image - image auto scaled to 2560x1707px and using how full size image. Example: Upload - [email protected] (3600x2400) ...
Степан Третьяков's user avatar
0 votes
0 answers
595 views

How to create thumbnails programmatically?

I've migrated content from a CMS (not WP) to Wordpress, through a nodejs script that uses the package wpapi (https://github.com/WP-API/node-wpapi). The main image is set as a featured image in ...
punkbit's user avatar
  • 161
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
0 votes
1 answer
2k views

Get featured image and additional posts thumbnail Wordpress REST API

I want to use the REST API of wordpress to build a new version of a custom theme. I'm able to get the json response of a particular category, but I need to find a way to obtain also the featured image ...
sialfa's user avatar
  • 319
0 votes
1 answer
2k views

Can I get thumbnail of taxonomy?

<?php $args = array( 'type' => 'itineraries', 'child_of' => 0, 'parent' => ...
Tyler Soffiantino's user avatar
0 votes
1 answer
614 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 ...
user4501876's user avatar
0 votes
2 answers
78 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:...
bpy's user avatar
  • 299
0 votes
0 answers
141 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 ...
Daniel Anton's user avatar
0 votes
1 answer
56 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( '...
JohnG's user avatar
  • 334
1 vote
2 answers
245 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' => '...
pressword's user avatar
  • 340
0 votes
1 answer
80 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 ...
Tnace's user avatar
  • 17
1 vote
1 answer
140 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 ...
Freddy's user avatar
  • 11
2 votes
1 answer
144 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 ...
Justin's user avatar
  • 23

1 2 3
4
5
33