Skip to content

Commit

Permalink
removing p from around imgs
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiemachado committed Dec 1, 2011
1 parent c48a8aa commit 739bcde
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/bones.php
Expand Up @@ -209,6 +209,15 @@ function page_navi($before = '', $after = '') {
}
echo '</ol></nav>'.$after."";
}

// remove the p from around imgs (http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/)
function filter_ptags_on_images($content){
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
}

add_filter('the_content', 'filter_ptags_on_images');




?>

0 comments on commit 739bcde

Please sign in to comment.