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 =
Display author avatar within posts or pages
Adding this snippet to your WordPress theme within the loop will display the current authors avatar. <?php echo get_avatar( get_the_author_email(), ’60’ ); ?>
Automatically wrap images in the_content with custom html
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
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’ );