Articles of images

Retrieve Image Attachments Getting Post Thumbnail Image First

I have written a funtion to get post image attachments, is there any way of ordering these images such that the first is always the post_thumbnail? Code below Thanks John function oliver_single_gallery_thumbs() { global $post; $args = array( ‘post_parent’ => $post->ID, // For the current post ‘post_type’ => ‘attachment’, // Get all post attachments ‘post_mime_type’ […]

How to obfuscate theme directory URLs

I’m rewriting this question because I realized it was totally unclear what I want to do. I’m looking for a way to “obscure” the theme directory so that absolute URLs that reference things like images and stylesheets in that theme directory don’t have the “wp-content/themes/my_theme/” structure, but are rather more direct, like a normal website, […]

Autosort uploads in galleries by filename

A client of mine wishes to not have to sort images uploaded into a post gallery, but instead rely on its filename for sorting (e.g. “01_sample.jpg”, “02_sample.jpg”). This would save a lot of time for the client, and I’m wondering if this is possible to achieve using WP 3.5+ and the recent changes to Add […]

Get custom thumbnail sizes

This question already has an answer here: Get post thumbnail size 7 answers

How can I use wp_save_image_editor_file filter?

I would like to use wp_save_image_editor_file filter, but there is no documentation on the internet. Also, it seems that no matter how many arguments I pass to the handler, all are null.

One picture belonging different galleries?

How can one picture belongs different galleries? For example, there are two galleries. I want to avoid loading the image twice (in two galleries) but it shown (included) in the first and second gallery.

Height and width attribute not setting by the_post_thumbnail

I am using following code to display images in home page: if ( has_post_thumbnail() ) {the_post_thumbnail(‘postbox-thumb’) But the output of the above code does not have height and width of the img tag. Please help me in solving this problem. Current sample output: <img alt=”Kiran inspects coal mine” class=”attachment-postbox-thumb wp-post-image” src=”″> img height and width […]

How to get the id or url of the image in an image post?

I have a bunch of image posts and I’d like to get the ID of those images I didn’t set a featured image so I can use wp_get_attachment_image_src() to get the urls of various sizes of those images. This is what I created: $img_posts = get_posts( array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_format’, ‘field’ […]

Featured Image problem with resizing

I want include function to resize featured image to 80×80, im add this code in my function.php add_theme_support(‘post-thumbnails’); set_post_thumbnail_size(80, 80); But is not work very good, images is not resized, looks like scaled to 80×65 or something.. i need exactly 80×80 on every images uploaded…

Uploaded attachment not set as featured image

The following code uploads an image which I want to associate with a custom post type. $upload_overrides = array( ‘test_form’ => FALSE ); if($file_errors[‘error’] == 0) { if($new_reseller_id = wp_insert_post( $new_reseller_profile_data )){ //$this->wps_process_image($file, $new_reseller_id);exit; $uploaded_file = wp_handle_upload( $file, $upload_overrides ); $wp_filetype = wp_check_filetype(basename($uploaded_file[‘file’]), null ); $wp_upload_dir = wp_upload_dir(); $attachment = array( ‘guid’ => $wp_upload_dir[‘url’] . […]