add image size still doesn’t work even after regenerating thumbnails

There are a couple of things to check here. First, make sure that add_theme_support( ‘post-thumbnails’ ) is loaded before add_image_size( ‘small-thumb’, 60, 60, true ) You can always hook everything through a function to the after_setup_theme hook. I always add these in my theme setup function function wpse_setup_theme() { add_theme_support( ‘post-thumbnails’ ); add_image_size( ‘small-thumb’, 60, … Read more

Disable resizing of gif when uploaded

image_make_intermediate_size was not the hook I was looking for, but intermediate_image_sizes_advanced. Here is a working code: function disable_upload_sizes( $sizes, $metadata ) { // Get filetype data. $filetype = wp_check_filetype($metadata[‘file’]); // Check if is gif. if($filetype[‘type’] == ‘image/gif’) { // Unset sizes if file is gif. $sizes = array(); } // Return sizes you want to … Read more

Which are precisely the predefined image sizes?

The defaults are Thumbnail 150×150, Medium 300×300, and Large 1024×1024. The fixed values can be changed in the admin dashboard under Settings > Media. You can also change them in your theme’s functions.php: update_option( ‘thumbnail_size_w’, 160 ); // Set Thumbnail width – default 150 update_option( ‘thumbnail_size_h’, 160 ); // Set Thumbnail height – default 150 … Read more

Graphing libraries for WordPress [closed]

Google Chart API Free service, that generates chart images (hosted and served by Google) from data in URL requests. If you need something very specific and of fixed parameters it is easy to hardcode most of it and get away without any library (and licensing issues) at all. Disadvantages: not suitable for sensitive data (passed … Read more

How can I hide media library images from general users?

To let the current users only view his/her uploaded attachments, add the following code to your themes actions: add_filter( ‘posts_where’, ‘devplus_wpquery_where’ ); function devplus_wpquery_where( $where ){ global $current_user; if( is_user_logged_in() ){ // logged in user, but are we viewing the library? if( isset( $_POST[‘action’] ) && ( $_POST[‘action’] == ‘query-attachments’ ) ){ // here you … Read more