Force image crop size in media editor
There is a very good plugin that I believe covers all you are looking for, and more: Scissors Continued. I’ve been using it extensively on several websites, and recommend it.
There is a very good plugin that I believe covers all you are looking for, and more: Scissors Continued. I’ve been using it extensively on several websites, and recommend it.
This example loops through all photographers and then displays all images uploaded by them: <ul> <?php $photographers = get_users( ‘role=photographer’ ); foreach( $photographers as $user ) : $pictures = new WP_Query( array( ‘author’ => $user->ID, ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inheret’, ‘posts_per_page’ => -1 ) ); echo ‘<li><h3>’ . $user->user_nicename . ‘</h3>’; if ( $pictures->posts … Read more
Tinymce and uploading local pictures
Let’s examine the differences between the working and the not-working code: Working: has_post_thumbnail( $post->ID ) Not Working: get_the_post_thumbnail(); The only difference I see is that you’re passing the $postID explicitly to the working function, and not passing it to the non-working function. So, try this: get_the_post_thumbnail( $post->ID, ‘medium’ ); You can var_dump() or echo it … Read more
I haven’t tried it, but I think that one proper solution could be to write a simple function that runs after the post is published (on save) and checks wether this post has images inside or not.If it has maybe is good to update a custom field in the post that will be a boolean … Read more
Make change in media library affect images in published articles
You can do this with an answer I gave here. You will still have to build the form yourself – but that should not be a problem.
I have added an image size <?php add_image_size( ‘test’, 300, 300, true ); ?> Uploaded an image of exactly 300 x 300px, Then got the image <?php wp_get_attachment_image_src( $id, array(300,300) );?> or <?php wp_get_attachment_image_src( $id, ‘test’ );?> Works both ways. Maybe you did not define the image size correctly in functions.php
This filter checks if an anchor is in the html image send to the editor and if so adds rel and class to the anchor. function add_highslide_attr( $html ) { preg_match_all(‘/(<a[^>]*>)(.*)/i’, $html, $result); if( !isset($result) || !isset($result[1][0]) || ! $result[1][0] ) return $html; $anchor = $result[1][0]; if( strstr($anchor, ‘rel=”) ) $anchor = str_replace(“rel=””https://wordpress.stackexchange.com/questions/77460/,”rel=”highslide ‘, $anchor); … Read more
Creating a post image to show in a gallery