WordPress append image dimensions as class names

When inserting images into post or page content WordPress automatically adds three class name to the image tag along with the other attributes, these are the alignment (alignnone), size (size-full) and the attachment id (wp-image-123).

If you need to add additional class names to the defaults without having to manually add them every time you insert a new image, you can make use of either the get_image_tag_class or get_image_tag filters. Continue reading “WordPress append image dimensions as class names”

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”

Extend WordPress search to include custom post meta

After receiving numerous requests to allow the SubHeading value in my plugin to be searched when carrying out a default search, I turned my attention to finding a method to achieve this in WordPress 2.9.x.

The plugin stores a custom post meta entry for any post or page that requires a subtitle, in order to append this field to the search query I required the use of two actions. Continue reading “Extend WordPress search to include custom post meta”

WordPress exclude categories from homepage

If you use posts within WordPress to generate content, such as Frequently Asked Questions or Help Guides, it’s quite often the case that you don’t want these to appear on the posts page of your blog.

Instead of having to re-create the whole query, you can append a comma separated list of category ID’s  that you want to exclude to the end of the original query and fetch the new data set to be used. Continue reading “WordPress exclude categories from homepage”

An attempt to write a blog post a day for a whole year

Over the past few days I’ve been setting up a small and simple, yet long term project in which I intend to write at least one blog post a day for entire year, starting with the first post on 1st January 2010.

The project preparation started on the 24th December when I registered the domain name yearblog.co.uk (a little dull, but to the point). Once that and the hosting side of things were ready I installed the latest version of WordPress (2.9) and began coming up with a few ideas for simple theme. Continue reading “An attempt to write a blog post a day for a whole year”