Get current post featured image ID
Sounds like you’re looking for get_post_thumbnail_id(): $featuredID = get_post_thumbnail_id(); It returns null if there’s not a featured image, so you may want to add a check for that.
Sounds like you’re looking for get_post_thumbnail_id(): $featuredID = get_post_thumbnail_id(); It returns null if there’s not a featured image, so you may want to add a check for that.
In this case I would add image size in functions.php which registers new image size in my theme and get the re-sized image. Example: Register custom image size (functions.php) if ( function_exists( ‘add_image_size’ ) ) { add_image_size( ‘custom-image’, 440, 265, true ); //(cropped) } Get custom image size (functions.php) function get_custom_image(){ global $post, $posts; $args … Read more
A little late to this party but it seems the OP wants to (1) prevent these WP Selfies from recurring and (2) remove existing WP Selfies. Here is a great filter to prevent it from happening in the future: http://andrewnorcross.com/tutorials/stop-hyperlinking-images/. And I just posted a snippet that removes existing self linking images here: http://cfxdesign.com/remove-existing-self-linking-images-in-wordpress/.
In general there is no such thing as a “featured image” for categories or other types of terms. The easiest thing to do is to integrate with existing plugins and themes that support this kind of functionality and/or supply an easy to use filter that for site owners to be able to customize where to … Read more
This simply doesn’t work. WordPress resizes the images while uploading, so if you don’t upload them again, nothing will happen.
wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), ‘medium’ );
Something like: <?php //Get the Thumbnail URL $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 720,405 ), false, ” ); echo $src[0]; ?>
Try installing Ajax Rebuild Thumbnails This will create the new image size.
Dammit, I just discovered that the $m->ID I was using wasn’t actually the post->ID, but the menu->ID. I used $m->object_id to fix the issue. Hope this will help someone in the future :-S
no problem to have 2 or more post thumbnails of different sizes. but what is the “ref” attribute ? do you mean “rel” ? anyhow – example from the :codex <?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘large’); echo ‘<a href=”‘ . $large_image_url[0] . ‘” title=”‘ . the_title_attribute(‘echo=0’) . ‘” >’; the_post_thumbnail(‘thumbnail’); echo … Read more