Add class to next and previous post_link

Posted by & filed under WordPress.

I recently needed to use this for a theme I was building figured I would post the results up here for everyone. Adding this snippet to the functions.php of your WordPress theme will add a custom class to next and previous post_link. function add_class_next_post_link($html){ $html = str_replace(‘<a’,'<a class=”next”‘,$html); return $html; } add_filter(‘next_post_link’,’add_class_next_post_link’,10,1); function add_class_previous_post_link($html){ $html =

Continue reading →

Automatically wrap images in the_content with custom html

Posted by & filed under WordPress.

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’);

Disable dragging of metaboxes within admin

Posted by & filed under WordPress.

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’ );