Themes and automatic_feed_links

Since WordPress 2.8, there is the function automatic_feed_links() in the function.php. Which writes the link elements for the RSS protocols in the header of the document. The advantage of this feature is, you do not need to worry about whether a change comes in the Feed-protocoll in a new version of WordPress, removed or a new one is added.

If we develop a theme for the general public, you have 2 options. You use automatic_feed_links() and the theme does not work with WordPress prior to version 2.8, or you do not use this function and write the links as before, in your header.php.

I also have a 3rd alternative ;).

if (function_exists('automatic_feed_links')) {
} else {
    add_action('wp_head', 'wpe_feed_links', 2);

function wpe_feed_links() {
    echo '<link rel="alternate" type="application/rss+xml" title="'. get_bloginfo('name').' RSS Feed" href="'. get_bloginfo('rss2_url').'" />';
    echo '<link rel="alternate" type="application/atom+xml" title="'. get_bloginfo('name').' Atom Feed" href="'. get_bloginfo('atom_url').'" />';
    echo '<link rel="alternate" type="application/rss+xml" title="'. get_bloginfo('name').' '. __('The latest comments to all posts in RSS').'" href="'. get_bloginfo('comments_rss2_url').'" />';

First we look if the function automatic_feed_links() exists. If not (prior to WP 2.8), we use the hook wp_head and write the links in the header of the page. Thus we don't need to adjust the header.php anymore.

Related Posts on Category

It's not easy to keep your readers on your website. It's a challenge to provide new readers valid information, even though they were written a while ago but still up to date. A good idea is to provide posts from the same category as the post, the reader is reading currently. You can create a little function, which is listing related posts based on the category ID.
Continue reading …

Define Your Own WordPress Action Hooks

WordPress is based on the so-called Hook-System. This serves WordPress, and all extensions to involve functions in a certain place. The Hooks are not only to hook, but can also be used in custom extensions and thus create a better overview and offer additional interfaces for more possibilities to develop. Especially the second option is interesting when you create a theme, which aims to offer a variety of interfaces, or create a Plugin which can be expand by other authors or serve as a framework.
Continue reading …

Bye Bye my-hacks.php?

Soon the new 2.8 version of WordPress will be released, but the hype is not as much as it was some years ago, when version 2.0 was released for example.

But the new version brings many new things, fixes a large number of problems and WordPress is in my view, more open than in the prior versions. One of the points that users should be aware of is the fact that the option for the support of the my-hacks.php removed. 2003 this file was announced as a feature, and now it's going to be removed silently. WordPress has a sophisticated interface system, you can start at various points and bring in new functionality, so that the developer team decided that there is no longer need to support this solution. Alternatives and possibilities of further usage will briefly shown here.

Continue reading …

Disable WordPress Search

Not always is the search in WordPress desired. The one or another application with WordPress doesn't need this feature. Even if it is an added value in my opinion. In some cases, it still shouldn't be displayed and so I have them deactivated with access to two hooks. For now, I can see no other place where you could access it in my applications and it works so smoothly.
Continue reading …

Filter caption-Shortcode in WordPress

The title may not speak for itself and therefore I will explain a little more on the topic and do not just put a code snippets on this post.

If you use the „Mediauploader“ in WordPress not just to load images, but also for integration in the post or page, then a Shortcode will be created and be insert in the content if you leave a picture title for this picture. The title should be maintained, because it will be used as alt-attribute to the img-Tag.

Not every user is satisfied with this issue and I'll show, how you can change the output.
Continue reading …