Autosort uploads in galleries by filename
When you or the client add the gallery shortcode, you can add an “orderyby” option to specify the order of the images. Per the Codex page on the gallery shortcode: … will do what you’re wanting.
When you or the client add the gallery shortcode, you can add an “orderyby” option to specify the order of the images. Per the Codex page on the gallery shortcode: … will do what you’re wanting.
For each image size, WordPress creates unique image on image upload. Than, when you register 7 image sizes, and upload single image, 8 unique images will appear in your wp-content/uploads directory. Is this too much for small blog with 100 posts to have 800 images on the server? But having 1000 posts? It depends. Another … Read more
In the 2nd attribute of the_post_thumbnail() you can give additional attributes for the image. the_post_thumbnail( ‘postbox-thumb’, array( ‘width’ => 100, ‘height’ => 100 ) ) I’ve just checked it again the width and height are set in the latest WP Versions, so you might have just to update your WordPress installation.
The filter inside ~/wp-admin/includes/image.edit.php looks like this: apply_filters(‘wp_save_image_editor_file’, null, $filename, $image, $mime_type, $post_id); So a callback would look like the following: add_filter( ‘wp_save_image_editor_file’, ‘wpse91038_saved_image_editor_file’, 10, 5 ); function wpse91038_saved_image_editor_file( $saved, $filename, $image, $mime_type, $post_id ) { var_dump( $saved ); var_dump( $filename ); var_dump( $image ); var_dump( $mime_type ); var_dump( $post_id ); return $saved; } Right … Read more
I found this stray code in the header.php $GLOBALS[blog_id] = get_option(‘woo_blog_id’); This wiped out the global variable that get_current_blog_id() relies on to get the site id in multisite. This is then used by wp_get_attachment_url() to build the appropriate URL. Because I was getting an incorrect site id, my attachment URLs were coming out wrong.
First, exclude the featured image (= post thumbnail) from the query, then set up the posts array as combination of the featured image and the other images. Put this directly below $args = … and above $attachments = …: if (has_post_thumbnail($post->ID)) { $featured_image = get_post_thumbnail_id($post->ID); $args[‘exclude’] = $featured_image; $attachments = array(get_post($featured_image)) + get_posts($args); } else
Sadly natively WP doesn’t allow to set custom default avatar in settings, just choose from fixed selection of options. Avatar retrieval is handled by get_avatar() function, which accepts third $default argument to which you can pass URL to desired default image. You will need to edit your theme to accomplish it in that way, or … Read more
Use get_template_directory_uri(): $url = get_template_directory_uri() . ‘/images/myimage.jpg’; This function will always return the correct path to your theme. If you want to hide/shorten that URL, you could use an endpoint, maybe img. The downside is, you load the complete WordPress for each image request. Or use mod_rewrite: RewriteRule ^img/([a-z\d-])\.png /wp-content/themes/my_theme/img/$1.png [L] This will not work … Read more
get_the_author_meta accepts two parameters $field – Field name for the data item to be returned. $userID – If a user ID is passed to the function, it will return data for the specified user ID. So just pass the user ID or author ID eg: if (get_the_author_meta(‘aim’,$author_id)) { …
Check the Codex. the_post_thumbnail accepts two parameters, the second of which is $attr— “attributes”. the_post_thumbnail(‘full’,array(‘title’=>’yay! a title!’)); The Codex entry for the_post_thumbnail is not clear on what is and is not allowed as an “attribute” but it appears to depend on wp_get_attachment_image and by filters applied by that function. title does work though. I checked.