File format of post image attachment

$post_thumbnail_id = get_post_thumbnail_id(); $thumb = get_post($post_thumbnail_id); var_dump($thumb); Look at the post_mime_type in the $thumb object. Reference http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail http://codex.wordpress.org/Function_Reference/get_post

Get uploaded image path in wordpress by filename

I am not 100% sure I understand what you want but… WordPress treats attached media like a custom post type. The file name, minus the extension, is stored as the post_title in the $wpdb->posts table. So, to get the path just search for the file name minus the extension. $q = new WP_Query( array( ‘fields’ … Read more

Populate a slideshow list of images from images in a wordpress page?

Most of this is part of the Codex: <?php $attachments = get_posts(array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ =>’any’, // This is where you specify the ID of your private image page ‘post_parent’ => $private_page_id, )); if (count($attachments)) { // We have attachments ?> <ul id=”flexiselDemo3″> <?php // Now we loop through them foreach … Read more

Confusion about arguments sent to add_image_size

As @PieterGoosen said, your point is valid. A look into the source confirms that the codex description of add_image_size was wrong there. It was, because I changed it to be correct. That said, everyone can help improving the codex, you just need to register. You might want to take a look at Contributing to WordPress … Read more

Plupload resize for worpdress

I’ve done a Plupload using the Front End. The WordPress Plupload is very customised, so I’ve implemented from the scratch as a Plugin. I’ll show an example using functions.php Download the Plupload from http://www.plupload.com/download/ and put in your theme inside a js/thirdparty/plupload/{all_files} Code to use on functions.php //Plupload File wp_enqueue_script( ‘plupload’, get_template_directory_uri() . ‘/js/thirdparty/plupload/js/plupload.full.min.js’, array( … Read more

How to show only posts with images?

No need for post IDs what has no thumbnail. Use meta query to get only those what has thumbnail. Add meta query function get_only_posts_with_images( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘meta_query’, array( array( ‘key’ => ‘_thumbnail_id’ ) ) ); } } add_action( ‘pre_get_posts’, ‘get_only_posts_with_images’ ); Or use custom query. $query … Read more

Featured image (responsive) above content is too small after update to WordPress 4.4

How can the global $content_width affect the post thumbnail ? Let’s check how the global $content_width can affect the output of the_post_thumbnail( ‘large’ ) and trace out the relevant function dependencies: the_post_thumbnail() \ \__ get_the_post_thumbnail() \ \__ wp_get_attachment_image() \ \__ wp_get_attachment_image_src() \ \__ image_downsize() \ \__ image_constrain_size_for_editor() and for the large size we have specifically … Read more