WordPreciousss 3.1b is out and has some bug fixes and some new features.

If you’re upgrading from version 3.0 it’s really just to upload the new files so they overwrite the old once. Also see the install and upgrade instructs.

So what’s new?

Precious Skinner included

WordPreciousss 3.1 should make it even easier for you to customize themes as Precious Skinner is (yet again) included in the main plugin.

This means that if you find it troublesome to create Child Theme or want to keep a Theme’s default style and just add styles , you can create a Skin instead.

And all Skins can have template files as well, which you can upload directly to a skin’s root directory inside WordPress.

I’ve also included six skins in WordPreciousss’ default theme (Precious), so you can get an idea of how to use the skinner feature.

Theme Switcher Widget

WordPreciousss 3.1b comes with a theme switcher widget which you can use to let your visitors decide what theme to use to view your site.

If you use pretty permalinks on your site, the visitor are redirected to the page or post their on when switching themes.

Note: The theme switcher widget will not show up on WPMU powered sites. - This is because it doesn’t respect the $allowed_themes variable.

New conditional tag: is_precious_theme

This is conditional tag you can use either if you let your visitors switch themes or if you use WordPreciousss on WPMU.

The usage is quite simple: is_precious_theme('Theme Name') and will allow you to show different things on different themes.

A good example is ads; a white background ad on a black background theme doesn’t look very nice, so with this conditional tag you can tell WordPress what ad to show on which theme:

if(is_precious_theme('Default')) {
echo $light_bg_ad;
elseif(is_precious_theme('ChaoticSoul')) {
echo $dark_bg_ad;
} ?>

This is just one of the possibilities you have with this function.

I’ve also added a conditional tag for skins that works the same way: is_precious_skin('Skin Name').

Filters, filters, filters

Now you can filter all template paths and urls, including the path to the global.css, print.css, favicon.ico, rss.png (used in Meta of the default template set).

This will allow you to set another favicon, create a new global css file, change the path to where the template files are stored, just to mention a few possibilities. And everything can be globally, theme only or even skin only.

So if you want another favicon (mine isn’t very nice as I’m not graphic wizard) on your site you can create a plugin like:

Plugin name: my favicon
function my_favicon() {
   $favicon_url = get_bloginfo('wpurl') . "/pathto/favicon.ico";
   return $favicon_url;
add_filter('precious_favicon', 'my_favicon');

If you want to play with this feature, just make sure you return the right url or path, depending on the function.

So what’s up with the “whatever version b“?

I’ve actually created one last minute feature while writing this post with WPMU in mind:

If you don’t want to create a special plugin for global settings, you may create a file called “my-precious.php” and upload it to /(mu-)plugins/wordpreciousss/

The my-precious.php will be loaded after all the other files, so you may use it to filter paths, favicon etc.

This feature is especially good at WPMU where all MU-Plugins need to be in the root directory. By having this option a WPMU site admin can have all files related to the plugin in the same directory.

Other changes

  • Bug fix; 404.php showed “called to undefined function” - this is fixed
  • Deprecated constants “MYOWNPATH”, “MYOWNURL”, “PRECOIOUSPATH” and “PRECIOUSURL”; use get_myown_template(), get_myown_template_uri(), get_precious_template() and get_precious_template_uri() instead.
  • Used precious_include_file() on all loop templates which mean you can hook into them with codes like add_action('after_include_page-loop','my_function');

And the future..

This is just ideas for the future, which I sometime down the line want to add to the plugin:

  • One click skins directory creator
  • Remake the global.css and print.css and let you edit them inside WordPress or hook into them with plugins or a theme’s functions.php file
  • Let you edit the global templates files in a similar way that the skins editor work today