WordPress: Prevent auto tags in page content

If you make use of some basic mark-up in your WordPress page content, you may have encountered an issue where <br /> tags are appearing where they shouldn’t and are affecting your theme layout.

To prevent this happening but leave the auto conversion of double line-breaks into paragraph tags, I had a dig into the wpautop function that runs before the content is outputted to the screen. Continue reading “WordPress: Prevent auto tags in page content”

WP – Add class name to first paragraph in blog post

When re-designing my blog I wanted to display the first paragraph of each blog post in bold text. A CSS3 selector could have been used, but wouldn’t work in older browsers such as IE6.

Instead I decided to write a very simple function to add a class name to the first paragraph by filtering the content, then setting the styles accordingly in my theme CSS file. Continue reading “WP – Add class name to first paragraph in blog post”