Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
11 views

How do I add a loop to featured images? [on hold]

I'm adding multiple images to featured images. And the theme I use is taking them as a preview. For example, I add 10 pictures. They are in turn playing just like a video preview. But he keeps going ...
0
votes
0answers
26 views

Add extra field to the post featured image Wordpress 5.0

This code work well for old wordpress 4.8 to add custom field into featured image box. Wordpress 5.0 in not working with add_filter admin_post_thumbnail_html add_filter( 'admin_post_thumbnail_html'...
1
vote
2answers
20 views

How to find post with broken image link and delete that post

I have some post in my autoblog that by cronjob mistake the feautured image being deleted. how to find all of that post (post with broken image link) and delete all of it or set the default image if ...
0
votes
0answers
9 views

How can I make the excerpt for a post be the featured image?

I am migrating a blog from blogger (ex blogspot) to wordpress and am looking to take each post's featured image and show it in its excerpt. So, how can I set an excerpt for a post to show the post's ...
0
votes
0answers
9 views

Automatic upload external image and set as featured post

I have a variable that automatic generates the url of thumb from youtube. For example one custom post has $video_thumb_url = 'https://img.youtube.com/vi/' . $matches_1['1'] . '/maxresdefault.jpg'; ...
1
vote
2answers
18 views

Change Featured Image / Thumbnail CMS Description

I'd like to be able to edit the description/help text that appears beneath the field in the CMS page editor for a custom post type. I know I can change the name and button/link text by passing items ...
0
votes
1answer
16 views

Featured image not shown in twitter post

I have a post with a featured image (size 736x212). The post url is this. I shared my post on twitter, but the tweet doesn't show the image (if you want to check click here). What could be the problem?...
0
votes
0answers
18 views

Missing image size

I have added a couple of custom sizes to my wordpress environment with the following code: add_image_size( "maximal", "1900" ); add_image_size( "desktop", "1400" ); add_image_size( "tablet", "900" ); ...
1
vote
1answer
40 views

How do I use <picture> element instead of <img> tags in WordPress post content having webP support?

I am developing my custom theme and trying to figure out how to modify the default code for WordPress image inserted into the post content, so I could add support for webP format and have it within &...
1
vote
0answers
22 views

How to delete posts that does not have a thumbnail?

I have a problem with my blog. The thing is this, all the posts have a thumbnail in this address: wpbv_postmeta-->meta_key-->thumb And several (A LOT) of posts don't work, because I have made a ...
0
votes
1answer
23 views

Serving a custom featured image for mobile

is it a good approach to serve multiple featured images to have a proper scaling? Right now the featured image size on "Desktop" is up to 1140x250. Pretty wide and will shrink way too far on "Mobile ...
0
votes
1answer
18 views

How to convert feature image as background image

I am trying to set background image out of feature image so I used the background-size:cover. Here is the code I have done but how can I add feature image into <div class="bg-img" style="background:...
0
votes
1answer
13 views

Images missing from Blog post page

I have created a blog named Tutsguru. When i visit Main page it shows feature images of blog post but when i visit Blog page then images are not shown. I tried different browser but same problem. Can ...
0
votes
0answers
12 views

New post won’t save category and featured image when published

I'm running a WP multisite installation and I just ran into this weird problem: I create a new post and after selecting the category and the featured image, I hit publish and the post gets saved and ...
0
votes
0answers
20 views

Generate_Featured_Image not working

im trying to use the function "Generate_Featured_Image", to set feature image to some post, ive created a api on my wordpress site, and im sending a external curl request from another site with link ...
0
votes
0answers
16 views

Error HTTP with Imagick on functions.php

When I upload jpg/png or mp3 files WordPress get ERROR HTTP. I have the following code on my functions.php: function register_watermarked_size() { add_image_size( 'watermarked', 550, 550, true ); //...
0
votes
0answers
36 views

wordpress responsive image srcset not working

I'm trying use wordpress core responsive image feature but it's not adding srcset to image. Here is th my codes I have a div w=370px h=280px now I added image sizes if(function_exists('...
0
votes
0answers
16 views

What are the implications if my images are loaded from external urls?

I have been working on multiple news websites where I display aggregated content. I am using XML's to get my data and I am using a parser I have written to post the articles on the websites. In the ...
0
votes
0answers
28 views

Display thumbnail from custom post type in template file

My single.php has a function for determining which template to use based on the custom post type - it will grab the corresponding template file and display it. I have registered these post types using ...
0
votes
0answers
16 views

Something in parent theme is preventing child theme from being able to crop images

I have a dilemna where I can't crop images with add_image_size() in my child theme. Instead of cropping, the images are scaled. I've tried all the usual stuff like regenerating images and changing ...
-2
votes
2answers
46 views

Get Post Thumbnail Outside of Loop

I am trying to get the post thumbnail image for each accordion or show accordion post thumbnail outside of the loop. Currently, it's setup with image empty but I need each thumb to represent the ...
0
votes
0answers
25 views

Adding Featured Image Programatically [duplicate]

I have thoroughly read the documentation my function is function set_featured_image($image, $post_id){ $image_path = '/var/www/html/wp-content/plugins/apkplugin/images/'; $wp_filetype = ...
0
votes
0answers
37 views

Get Thumbnail from Page link or Taxonomy Slug

kind of struggling with a task but also writing to see if what i'm doing makes sense. Simple question is I can't return the thumbnail in a foreach loop. Background is I am using a taxonomy to map ...
0
votes
2answers
23 views

Is it possible to show thumbnails along with recent post from a wordpress blog on static website's homepage?

Please help me to figure this out that I want to show thumbnails along with recent post from a wordpress blog on static website's homepage. Following code are working fine but I need to show one ...
0
votes
0answers
17 views

Set featured image from video

I'm working on a Wordpress website and I have created a category for videos. I created an article with video as the format, and I inserted a youtube video in the content. When I view the article, ...
0
votes
0answers
19 views

Image size in browser is defaulting to fill the container despite editor / styling settings

I am in the process of building my first theme. I have built everything up slowly and have a very simple setup. Now I am stuck on something that is probably a very easy fix. Problem: When I add an ...
1
vote
1answer
56 views

Adding Featured Image to Post programatically

How do I add a Featured Image programatically, given the URL/filename of the image, and Post ID associated with it?
1
vote
1answer
74 views

Featured images not displaying at full resolution

The image in my media library is 560×315, but when I inspect the image this is the code I find. srcset images are being loaded instead of my full resolution image. <img src="https://domain.com/...
0
votes
0answers
11 views

Display child page featured image on parent page and link together

I have a parent page that is based on Template A. Under this page is a child page on Template B - on this page goes the content and has a featured image that I need to get on parent page. So the idea ...
0
votes
0answers
7 views

Select image from post and make it featured image

I'm trying to use images in post as thumbnail if the post hasn't thumbnail, but it's doesn't work function homepage_get_attachment( $num = 1 ) { $output = ''; if( has_post_thumbnail() && $num ...
0
votes
0answers
29 views

How can I use an image from an external source without uploading it to the media library

I am looking for a way to tweak my xml parser code to insert a url from an external source into a new post, instead of first uploading it to the website's media library and than adding the attachment. ...
0
votes
0answers
31 views

Why image Thumbnail url is not displaying with custom size?

The website has only one thumbnail size 375x211. I want to show this size thumbnail image at site homepage so that when I copy this image it only copies in 375x211 size, not in full image size which ...
0
votes
1answer
20 views

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

I want to link featured images of every WordPress post automatically for only visitors. So it should not be available for logged-in users of WordPress. It should only link featured images of single....
0
votes
0answers
19 views

Cannot change links to old legacy thumbnails

I have a wordpress installation where the content has been imported from another very old version of wordpress in order to rebuild the site and modernise it. However, upon selecting various themes and ...
0
votes
2answers
28 views

WP_Query how to add a thumbnail to the first post from the last 5 posts?

I've a query like this: <ul> <?php $the_query = new WP_Query( array( 'cat' => '1', 'posts_per_page' => 5 ) ); ?> <?php while ($the_query -> have_posts()) : $the_query -> ...
-1
votes
1answer
44 views

Use Post Title as alt text for Featured Image

There are previously-asked questions but either they don't work with my theme or I'm too stupid to figure them out. Essentially my chunk of code is below and I'm using the Avada WordPress theme (you ...
0
votes
0answers
17 views

Featured image: How to only show the width and height of an image when there's a featured image?

I've found a way to display the width and height of a featured image in the admin panel. The problem I have now is that if there isn't an image, it shows the 'x' above 'set featured image'. How do I ...
0
votes
0answers
20 views

set the featured image of post as slider image

i am trying to set the featured image of a post as slider image in page , the problem the images that i get does not full the slider with , here is the code the i tried <!-- SLIDER CODE ########...
1
vote
1answer
57 views

How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts

How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts: i have this code here: add_action( 'wp_head', 'set_featured_background',...
0
votes
0answers
17 views

How to control resizing of additional image sizes

Is there a way to resize a custom image size in two additional sizes that are specifically for that image size? For example, I want to add the following image sizes to my WP theme, one for a full-...
1
vote
2answers
160 views

How to display featured images for all posts with certain taxonomy label?

I have created a post taxonomy in functions.php called 'leadership' and then tagged posts with three different labels. I have a team page on which I want to place three links (each slugged to a label ...
1
vote
1answer
76 views

Delete all post meta except featured image Using SQL

Please I just migrated my site and I found out that wp_postmeta consumes most of my cpu resources, Is the any Sql code to Delete all post meta except the featured image. I dont want to Use wp ...
0
votes
0answers
13 views

How to add link to an image of a post in post slider(postboard)

I want to fix this issues without plugins. add_action( 'widgets_init', 'goodlayers_1_4_banner_init' ); function goodlayers_1_4_banner_init(){ register_widget('Goodlayers_1_4_Banner_widget'); ...
0
votes
2answers
42 views

Post thumbnail not displaying correct size

I created a custom template. It contains 3 columns, and the middle column should only display the post thumbnail. But no matter what size attribute I'm setting, it's not changing the size the way I ...
0
votes
1answer
37 views

Get Post's first image using Short-code

i'm trying to get post's first image(LINK) , Currently i'm using Shorcodes Ultimade plugin for it so far i'm able to get post's content using the following shortcode on my static homepage page [...
0
votes
2answers
13 views

How to show scaled featured image in template?

I need to show the post featured image at the desired position on my theme template. At the same time, I need its width to be 300px and the height- adaptive. What code should I add to my template?
2
votes
0answers
24 views

Save image as featured image

I am using WordPress 4.9.7 and I am trying to develop a plugin that downloads an image from a website and saves it in the media library and sets it as featured image on a post. Find below my full ...
0
votes
0answers
77 views

Use Lightbox effect for Featured Images

I'm trying to apply the lightbox effect to the thumbnails, since I don't want the photos to redirect to the direct url to them, and I've got no luck trying to set it up. I've tried adding this code ...
2
votes
1answer
96 views

Unexpected width and srcset attributes for the_post_thumbnail();

I am modifying a theme, using a child theme, and in a template file (single.php) I need to display a large post thumbnail, so I have this code: the_post_thumbnail('large'); In Settings > Media, the ...
0
votes
0answers
41 views

Delay WordPress auto thumbnails generation for specific image size i.e. 'medium'

I am trying to delay WordPress auto thumbnail generation for specific image size only i.e. 'medium'. As I am using GD library to print Post Title on the image automatically, and it replaces the ...