Adding this snippet to the functions.php of your WordPress theme will automatically wrap images in the_content with any custom HTML that you wish. function filter_images($content){ return preg_replace(‘/<img (.*) \/>\s*/iU’, ‘<span class=”className”><b><img \1 /></b></span>’, $content); } add_filter(‘the_content’, ‘filter_images’);
Posts By: Renat
Disable dragging of metaboxes within admin
Adding this snippet to the functions.php of your WordPress theme will disable all dragging of metaboxes within the admin. Please note that this includes dashboard widgets as well. function disable_drag_metabox() { wp_deregister_script(‘postbox’); } add_action( ‘admin_init’, ‘disable_drag_metabox’ );
Check if post / page has a gallery
Adding this snippet to your WordPress theme will let you check to see if a post contains the gallery shortcode. Add this code to the single.php template of your WordPress theme inside the loop. if (get_post_gallery() ){ echo ‘has gallery’; } else { echo ‘has no gallery’; } If you want to show the gallery
Remove XML-RPC when not in use for performance boost
WordPress uses a CURL operation to test for SSL capability for XML-RPC. If you’re using XML-RPC but not using, then you can remove the filter. This is a small performance boost (since basically WP does a cURL GET on the https url and either 1) gets a denied message, or 2) times out, and it