Using wp_get_image_editor in a standalone script

Turns out I’m just silly. WP_Error was the undefined method, not resize. I was sending a bad image location through the resize function. How silly of me! It was working all along. I’ve included this on top $parse_uri = explode( ‘wp-content’, $_SERVER[‘SCRIPT_FILENAME’] ); require_once( $parse_uri[0] . ‘wp-load.php’ ); and this is my image resize function … Read more

Insert image in comment reply

What you’re looking for could be a wp_editor() in comment form : wp_editor( $comment->comment_content, ‘content’, array( ‘media_buttons’ => true, ‘tinymce’ => false, ‘quicktags’ => $quicktags_settings ) );

Use image url with add_image_size

The pattern you posted… www.mydomain.com/image.jpg(‘custom-thumb’); … is a bit odd. That would be pretty tricky. You’d need a PHP handler to load the image and you’d need to tell the server (Apache, Nginx, IIS, Whatever) to parse that file ending as PHP. Something like this would be simpler: www.mydomain.com/image.php?size=custom-thumb You would still need to create … Read more

Is there a shortcut to change bulk BMP images to JPG images in a site?

Assuming you add the files with the matching filenames in the appropriate wp-content/uploads/ folders you could run a few SQL queries to update the WordPress database to use the .jpg files. Assuming your wpdb prefix is wp these queries would be: UPDATE wp_posts SET post_mime_type = replace(post_mime_type, ‘image/bmp’,’image/jpeg’); UPDATE wp_posts SET guid = replace(guid, ‘.bmp’,’.jpg’); … Read more

Limit function to specific post category

You should check for category posts to modify content. Specify category ID (integer), name or slug (string), or an array of these in in_category check. function my_image_tag( $html, $id , $alt, $title ) { if ( in_category( ‘1’ ) ) { $html = “<div class=”my-class”>” . $html . “</div>”; } return $html; } add_filter( ‘get_image_tag’, … Read more

Custom image size in Media Dropdown

The above problem got fixed after regenerating the thumbnails and by using the following function. function mytheme_image_size_names( $sizes ) { $sizes[‘blog_body_img’] = __( ‘Blog Body Image’, ‘isaumya’ ); return $sizes; } add_filter( ‘image_size_names_choose’, ‘mytheme_image_size_names’, 11, 1 );

How to show category images (from plugin) on a regular page (page-example.php)?

Untested, but something like this should work. $siteurl = home_url(“https://wordpress.stackexchange.com/”); $tax = ‘region’; // slug of taxonomy $terms = get_terms($tax); foreach ($terms as $term) { $id = $term->term_id; $slug = $term->slug; $description = $term->description; $image_url = z_taxonomy_image_url( $id, NULL, TRUE ); $link = “<a href=”https://wordpress.stackexchange.com/questions/176555/$siteurl?$tax=$slug” ><h1> $term->name </h1></a>”; echo $link; echo ‘<p>’ . $description . … Read more

Remove dimensions from filename featured image

In addition to creating additional dimension, WordPress does keep your original image. Your original image is in this link http://whatweblog.com/wp-content/uploads/2015/05/hue.gif So, instead of stopping WordPress from creating additional dimension, you should retrieve the full image when displaying the featured image. You can get the full image with this – the_post_thumbnail(‘full’); In your case, change <?php … Read more