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')) {
    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.

Deactivate WordPress Default Widgets

You do not always want to have all the widgets active, which comes within the WordPress core.

You can disable the unneccessary Widgets in your functions.php of your theme with a small function. The following syntax will switch off all the standard widgets. It should therefore be adjusted depending on your requirements:

// unregister all default WP Widgets
function unregister_default_wp_widgets() {

	unregister_widget('WP_Widget_Pages');

	unregister_widget('WP_Widget_Calendar');

	unregister_widget('WP_Widget_Archives');

	unregister_widget('WP_Widget_Links');

	unregister_widget('WP_Widget_Meta');

	unregister_widget('WP_Widget_Search');

	unregister_widget('WP_Widget_Text');

	unregister_widget('WP_Widget_Categories');

	unregister_widget('WP_Widget_Recent_Posts');

	unregister_widget('WP_Widget_Recent_Comments');

	unregister_widget('WP_Widget_RSS');

	unregister_widget('WP_Widget_Tag_Cloud');
}

add_action('widgets_init', 'unregister_default_wp_widgets', 1);

The function unregister_widget() needs as parameters the class, therefore the code is working since version 2.8 only. In prior versions, Widgets were supported differently.

How to create your own Widgets since WordPress Version 2.8 is explained in Build A WordPress 2.8 Widget With The New Widget API.

WordPress Basis Theme – Also In HTML5

Since I deal with WordPress (version 0.71), I have my own theme layout created, which I always use to start with a new theme - WP Basis.
I published this theme under GPL since then and it is quite popular. I have continued the development on the theme and it has grown with every version of WordPress up to 2.8.2. To better handle these changes, I put the theme in the SVN of Google Code and were able to profit of the cooperation of Andreas and Dominik - many thanks to them!

The theme is also backward compatible, tested up to version 1.5 of WordPress.

Download the theme here

FYI, the theme is not a Framework, it is a simple theme, which contains the foundation of a theme only and also a variety of little features from my experience with WordPress. It really means that you have a theme for your clients or yourself created, adapted to the requirements. It doesn't contain any unnecessary markup, as you have with most Frameworks. It will remain as it is now, no Child-Themes or something similar, no hooks for comfortable implementing of code. I like this kind of work, lean and fast, direct to the point. That's why I'm not a big fan of Frameworks in WordPress, but that does not mean that other developers should do the same!

If you like this kind of work and you always write your own theme, then Basis Theme might be something for you. By the management in the SVN you are also have the opportunity to report errors and issues. It would be great if you could help to make this theme even better.

The future

I began to build the Basic Theme in HTML5, so that WordPress can work with it. I also added an example stylesheet, so there is a design available.

In addition, there is a small stylesheet, which displays the new fields and their tags, a good start in HTML5 to have it more visual. The stylesheet is not included in the code but can be added via the web developer toolbar. You can find the stylesheet in the structure under layout/html5areas/html5areas.css. A post with this stylesheet looks like that:

html5areas

Several parts are currently only in Opera > 9.5 visible. These include all the contents of the comment form.

form-opera

Work with ...

As a reference I use the summary of w3c and the blog about HTML5. Unfortunately, validating is not so easy, because I don't know any validator which can validate locally. If you know one, please let me know. For IE, I added a script, which teaches IE to deal with various elements.

Why all this?

It would be great if one or another can look at it, maybe people who have a profound knowledge of HTML5. Feedback would be great and perhaps one or other might expand the theme with specific tags or elements.

How do I get it?

There is no download link and as of now there are only a few guidelines but it should become the same as WP Base Theme. To become acquainted with the theme or just look over it, you can check it out in the repository. There you are able to comment and discuss.

The folder with all contents can be found in trunk/basis-html5 of the SVN.