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
24 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 ...
1
vote
1answer
30 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'] !==...
0
votes
0answers
115 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 ...
0
votes
1answer
37 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 ...
2
votes
1answer
187 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( '...
1
vote
0answers
15 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 ...
0
votes
0answers
14 views

Conflicting image ID on importing posts in WP

If I import posts into an existing website and the post ID is conflicting, WordPress creates a new post ID. But this does not work for media ID's. If I import the posts, it attaches current media ID's ...
0
votes
1answer
30 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 ...
0
votes
1answer
88 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] => ...
0
votes
1answer
118 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 - Web_18.12.22_01@2x.jpg (3600x2400) ...
0
votes
0answers
33 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 ...
0
votes
1answer
57 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 ...
0
votes
0answers
81 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 ...
0
votes
1answer
31 views

Can I get thumbnail of taxonomy?

<?php $args = array( 'type' => 'itineraries', 'child_of' => 0, 'parent' => ...
0
votes
0answers
22 views

How to pass a YouTube thumbnail URL through the a custom image size

I'm currently displaying YouTube thumbnails directly from YouTube using this format which works: <img src="http://img.youtube.com/vi/<?php echo youtube_id; ?>/maxresdefault.jpg" /> ...
0
votes
0answers
15 views

Category post thumbnails are not displaying (Some post thumnails are displaying icon as thumbnail)

I am working on a website where i tried all default settings in wordpress dashboard to display thumbnails for category posts, but it is displaying icon as post thumbnail, i have not customized any ...
0
votes
1answer
22 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
0answers
25 views

Different Featured Image on Single Post vs. Archives

I am working on thewellnessproject.net (if relevant). I would like to have a different image set as the featured image for the Single Post view as compared to everywhere else (Archives, etc.). I ...
0
votes
2answers
29 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
9 views

Srcset doesnt show at all in my wordpress images

I have added 10 image sizes: add_image_size( '1920', 1920, 384, false ); add_image_size( '1600', 1600, 320, false ); add_image_size( '1536', 1536, 307, false ); add_image_size( '1440', 1440, 288, ...
0
votes
0answers
13 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
29 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
25 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
16 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 ...
0
votes
0answers
20 views

Replace wp_get_attachment_image with lqip image size

I created the image sizes as follows, add_image_size( 'size-260', 260, 0, false ); //260px Original add_image_size( 'size-260-landscape', 260, (int) round( 260 * 0.7 ), true ); //260px Landscape ...
1
vote
1answer
14 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
36 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
7 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
0answers
24 views

Remove Srcset Image From the_post_thumbnail

I want to delete the srcset image in the related posts widget. Here is my related posts function code: // START related posts function get_max_related_posts( $taxonomy_1 = 'post_tag', $taxonomy_2 = '...
0
votes
1answer
19 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
67 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 ...
0
votes
0answers
14 views

Dynamic featured video in wordpress custom theme

a question about using content dynamically for a custom wordpress theme. Today the relational databases reason in terms of tera, but the rule is always the less contents there are to load the faster ...
1
vote
0answers
27 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 ...
0
votes
0answers
13 views

wordpress upload image and set as featured

I would need your help since I'm getting "crazy" as I can't figure out how to do this. Basically I have an ajax call that sends an URL and name to PHP function that uploads the file. It's supposed to ...
1
vote
1answer
24 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
16 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
29 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
19 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
398 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
75 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
30 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
30 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
60 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
12 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
31 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
55 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
68 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
35 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
11 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
120 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 ...