Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

post-thumbnails

How do I get posts where image is larger than…?

There is no clean way to do this. Each image stores image information in post meta table, but as a part of the serialized PHP string. Using MySQL for that is out of the question because MySQL doesn’t have a syntax for extracting regular expressions matched content, it can only use perform true/false/like expressions using … Read more

Categories post-thumbnails Tags get-posts, post-thumbnails

Does delete_post_thumbnail() actually delete the image?

No it certainly doesn’t. It is simply a case of poor choice of naming. The function should have been named unset_post_thumbnail(), particularly when we already have set_post_thumbnail(). Today’s WordPress annoyance.

Categories post-thumbnails Tags post-thumbnails

Images uploaded on frontend display correctly but not in media editor.

It appears you’ve taken the super long winded route and done each step of the upload manually. But why not use the sideloading function that does it all for you? The majority of your code can be replaced with this: // These files need to be included as dependencies when on the front end. require_once( … Read more

Categories post-thumbnails Tags front-end, images, media-library, post-thumbnails

Pull through featured image in a custom menu

<?php $navMenu = wp_get_nav_menu_items(6); foreach ($navMenu as $menu) { echo ‘<li style=”background-image:url( ‘. get_the_post_thumbnail_url( $menu->object_id ) .’ )”>’; echo ‘<a href=”‘. $menu->url .'”>’. $menu->title .'</a>’; } ?>

Categories post-thumbnails Tags post-thumbnails

How can i find posts with duplicate featured images?

The featured image’s ID is saved in a post meta field by the name of _thumbnail_id, so with a little bit of joining, you can use MySQL to search them for you: SELECT p1.ID as ID1, p2.ID AS ID2 FROM wp_posts p1 LEFT JOIN wp_postmeta pm1 ON (p1.ID = pm1.post_id AND pm1.meta_key = ‘_thumbnail_id’), wp_posts … Read more

Categories post-thumbnails Tags duplicates, post-thumbnails

How to select which thumbnails sizes are displayed in srcset

The 2nd argument of the_post_thumbnail() is an array of attributes and values, so you can just set your own srcset attribute that way: the_post_thumbnail( ‘my-custom-size’, array( ‘srcset’ => wp_get_attachment_image_url( get_post_thumbnail_id(), ‘my-other-custom-size’ ) . ‘ 1000w’, ) );

Categories post-thumbnails Tags post-thumbnails, responsive

How Do I Create A WordPress Secondary Featured Image Without A Plugin? [closed]

I don’t want to use the many available plugins or a custom field. Even a code only solution would use a custom field for this. It’s metadata about the post, so you use a custom field for it. That’s what custom fields are. Also, the code for your custom solution would live in a plugin, … Read more

Categories post-thumbnails Tags post-thumbnails

Check category before displaying featured image

has_category() will do the trick. You can pass it an ID or slug, or an array of IDs or slugs, and it will return true if the post has any of the given categories: // ID if ( has_category( 1 ) ) { the_post_thumbnail( ‘full’, array( ‘class’ => ‘img-responsive’ ) ); } // Slug if … Read more

Categories post-thumbnails Tags post-thumbnails

custom class and size for the_post_thumbail

Try To Use it Like This : <?php the_post_thumbnail( array (475, 317), [ ‘class’ => ‘border–round’ ] ); ?>

Categories post-thumbnails Tags post-thumbnails

How do I add thumbnail to current Prev and next buttons in posts?

Without more context it’s hard to be sure, but it looks like this function is being called twice: once for each link ($direction=”next” and $direction=”previous”). The $posting parameter looks to be the next or previous post. If my assumptions are correct, you need to get the thumbnail for that post: $thumbnail = get_the_post_thumbnail( $posting->ID ); … Read more

Categories post-thumbnails Tags post-thumbnails
Older posts
Newer posts
← Previous Page1 … Page32 Page33 Page34 … Page74 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress