How can I add a fifth option to the alignment picker?

You mentioned using the class in your comment. You could try just adding max-width:100% to the css from the link you provided. Or use jQuery: $(document).ready(function(){ $(‘img.fulljust’).each(function(){ if($(this).width() > 300){ $(this).css({ ‘width’ : ‘100vw’; ‘position’: ‘relative’; ‘left’: ‘50%’; ‘right’: ‘50%’; ‘margin-left’: ‘-50vw’; ‘margin-right’: ‘-50vw’; }); } }); }); EDIT: I realized I didn’t answer your … Read more

Check if image exists before uploading with media_sideload_image()

I wonder if you’re looking for the core attachment_url_to_postid() function that uses: $sql = $wpdb->prepare( “SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_attached_file’ AND meta_value = %s”, $path ); $post_id = $wpdb->get_var( $sql ); Note the extra meta key _wp_attached_file check compared to your current snippet. If you need to check if an image url … Read more

Automatically delete attachments and posts [closed]

You can solve your problem with a WordPress Cron Job. I wrote this code and cron scheduler. Also i tested this code on my localhost. If you add this code to your theme’s functions.php you can solve your problem. Cron job and function will work every day and search old posts and their attachments for … Read more

Adding attachment file name to email link

You can get the original attachment filename via wp_get_attachment_url: echo basename( wp_get_attachment_url( $post->ID ) ); or in the form of the example you provided: <a href=”https://wordpress.stackexchange.com/questions/91547/mailto:[email protected]?Subject=Image: <?php the_title(); ?> – <?php echo basename( wp_get_attachment_url( $post->ID ) ); ?>”>Get in touch about this image</a>

Re-process Images

When you insert an image into a WordPress post, its display size is determined by the size setting you pick on the insert dialog: If your server is configured to support WordPress’s image resizing (most common hosts configure their servers so this isn’t an issue), a resized version of the image you enter should be … Read more