Small image resizing for big! Alternative to timthumb

If you’re always blowing up a small image to a larger size, and don’t care about the resulting loss in quality (although personally I would, for photos at least) then you might as well simply override the height and width in CSS (or inline HTML) – there’s no gain in making the image file on … Read more

Different image margins on different pages CSS [closed]

You would need to recode your CSS a little. Since you have your beer image in its own container that helps. But you’d want to adjust the CSS: .beer-description{ float: left; width: 70%; } You can tweak it as needed. To not worry about the image size, you should have a width set (can be … Read more

Display images in template file

if You wish to display an image, which is a thumbnail of a post, then use: <?php echo get_the_post_thumbnail( $pageID, ‘thumbnail’ ); ?> if You wish to display an image from media, then use <?php echo wp_get_attachment_image( $attachmentID, ‘thumbnail’ ); ?> thumbnail is set for size and is set by default. Size can be changed … Read more

Change default “Apply Changes To” radio option when editing images

It is hopeless to hook into the image-edit.php ajax loaded screen. This issue, to pre-select “thumbnail only” radio option instead of “all images” can be solved by jQuery. The snippet in your functions.php can be improved, but works: // Populate thumbnail settings function entex_admin_image_editor_activate_tweaks() { ?> <script type=”text/javascript”> jQuery(document).ready(function($) { $(document).ajaxStop(function(){ if($(‘.imgedit-settings input[value=”thumbnail”]’).get(0)) { $el … Read more

add class to background image

I have added the style “background-position: center center;” and it work perfectly! So the new code will look like this: <?php global $post; $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, ” ); ?> <div class=”mainblogwrapper” style=”background-image: url(<?php echo $src[0]; ?> ) !important; background-attachment : fixed;background-position: center center;”>

SVG files and wordpress

You’re going to have to edit your functions.php file and add a few lines. This article has a better explanation. I suggest you try here if you haven’t already. https://css-tricks.com/snippets/wordpress/allow-svg-through-wordpress-media-uploader/

If file exists with page slug name show image else nothing

EDITED ANSWER – First get the full file path to your image and store it to a variable $filename. Use file_exists to check if image exists, and output the image and with it the title of your image. If the condition fails, there is no output. https://codex.wordpress.org/Function_Reference/wp_upload_dir <?php global $post; $slug = get_post( $post )->post_name; … Read more