WordPress taxonomies

In WordPress, a taxonomy is a grouping mechanism for posts. WordPress has three built in taxonomies : categories, tags and links. WordPress allows to create your own custom taxonomies which are an extremely powerful way to group various items in all sorts of ways.

I created the custom taxonomy Family for my family blog. The WordPress plugin Custom Post Type UI, developed by Brad Williams and Michael Beckwith, is a useful tool to manage custom taxonomies.

Additional informations about WordPress taxonomies are available at the following links :

WPtouch 3 Pro WordPress Taxonomy Support

Last update : July 20, 2013
I use the WPtouch 3 Pro plugin for my WordPress Family Blog, together with the User Access Manager (UAM) plugin, created by Alexander Schneider. I noticed that the taxonomy support of WPtouch 3 Pro does not work as expected. All categories and tags are displayed on the mobile without respecting the restrictions defined by the UAM plugin. The reason is that WPtouch retrieves the taxonomy informations directly from the database with an SQL request, instead of using the wordpress functions get_categories() and get_tags(). For categories WordPress even offers the function wp_list_categories() with formatting support.

Usually I don’t like to modify the core code of WordPress themes and plugins, but in this case the only feasible solution to solve this problem was to change the two functions wptouch_fdn_ordered_cat_list() and wptouch_fdn_ordered_tag_list() in the WPtouch 3 Pro theme foundation file plugins/wptouch-pro-3/themes/foundation/root-functions.php.

function wptouch_fdn_ordered_tag_list( $num, $include_count = true )

I changed the following code :

echo '<ul>';
$sql = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}term_taxonomy INNER JOIN {$wpdb->prefix}terms ON {$wpdb->prefix}term_taxonomy.term_id = {$wpdb->prefix}terms.term_id WHERE taxonomy = 'category' AND {$wpdb->prefix}term_taxonomy.term_id NOT IN ($excluded_cats) AND count >= 1 ORDER BY count DESC LIMIT 0, $num");
if ( $sql ) {
foreach ( $sql as $result ) {
if ( $result ) {
echo "<li><a href=\"" . get_category_link( $result->term_id ) . "\">" . $result->name;
if ( $include_count ) {
echo " <span>(" . $result->count . ")</span></a>";
}
echo '</a>';
echo '</li>';
}
}
}
echo '</ul>';

by the new code :

$args = array (
'orderby' => 'count',
'order' => 'DESC',
'exclude' => $excluded_cats,
'number' => $num );
$categories = get_categories($args);
echo '<ul>';
foreach ($categories as $category) {
echo '<li><a href="' .get_category_link($category -> term_id). '">' .$category -> name. '';
if ($include_count) {
echo '<span> (' .$category -> count. ')</span>';}
echo '</a></li>';}
echo '</ul>';

function wptouch_fdn_ordered_cat_list( $num )

I changed the following code :

echo '<ul>';
$sql = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}term_taxonomy INNER JOIN {$wpdb->prefix}terms ON {$wpdb->prefix}term_taxonomy.term_id = {$wpdb->prefix}terms.term_id WHERE taxonomy = 'post_tag' AND {$wpdb->prefix}term_taxonomy.term_id NOT IN ($excluded_tags) AND count >= 1 ORDER BY count DESC LIMIT 0, $num");
if ( $sql ) {
foreach ( $sql as $result ) {
if ( $result ) {
echo "<li><a href=\"" . get_tag_link( $result->term_id ) . "\">" . $result->name . " <span>(" . $result->count . ")</span></a></li>";
}
}
}
echo '</ul>';

by the new code :

$args = array (
'orderby' => 'count',
'order' => 'DESC',
'exclude' => $excluded_tags,
'number' => $num );
$tags = get_tags($args);
echo '<ul>';
foreach ($tags as $tag) {
echo '<li><a href="' .get_tag_link($tag -> term_id). '">' .$tag -> name. '<span> (' .$tag -> count. ')</span></a></li>';}
echo '</ul>';

The new code provides the same WPtouch features and functionalities as the old one and is fully compatible with the UAM plugin.

One disadvantage of core changes in a plugin is the need to replace the modified files when an automatic update of the plugin is done. This was the case in July  2013 when the new versions 3.0.5 and 3.0.6 were loaded.

WordPress Post Formats

Post formats have been around since WordPress 3.1. They specify the format applied to a content. Post formats are different from Post Types which specify the type of content : post, page or maybe a custom type like books or products.

The following Post Formats are supported :

  • standard : post with title, date and author
  • aside : post without title and data, with the hint “aside”
  • link : post without title and data, with the hint “link”
  • gallery : first picture of a native gallery and number of pictures in the gallery
  • status : format like Twitter, with a gravatar
  • quote : post without title and data, with the hint “quote”
  • image : special format for photoblogging
  • video : special format for videos
  • audio : special format for audios
  • chat : special format for chat logs

Post Formats

The WordPress theme Twenty Ten supports the standard, aside and gallery format. The new theme Twenty Eleven supports all formats, but video, audio and chat need to be activated by adding them to the post formats array in the theme file functions php :

// Add support for a variety of post formats
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image', 'chat', 'video', 'audio' ) );

They need to be styled further in the corresponding css-file.

To add the Post Formats in a child theme, you must ensure that the childtheme setup occurs after the parenttheme setup. This is the code :

function childtheme_setup(){ add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image', 'chat', 'video', 'audio' ) ); add_action( 'after_setup_theme', 'childtheme_setup' );

The following list shows links to useful tutorials and documentation about WordPress Post Formats :

Hereafter are some older posts about WordPress themes and templates :

WordPress WPtouch Pro Plugin

Last update : May 22, 2013
WPtouch is a free WordPress plugin that automatically transforms a WordPress website for mobile devices. The admin panel allows you to customize many aspects of the mobile theme appearance and allows visitors to switch between the mobile view and the site’s regular theme. The latest version of the plugin is 1.9.6.3, updated May 3, 2013. WPtouch is a trademark of BraveNewCode Inc., a small Canadian company established in 2008 by Duane Storey and Dale Mugford.

WPtouch pro is the enhanced version of the WordPress Plugin. I subscribed to the “old” pro version in December 29, 2010 for the current website. The latest version of this old plugin is 2.8.2, support will continue until July 5th, 2013. On May 22, 2013 I purchased a license for the new WPtouch pro 3 plugin for my family website blog.

WPtouch Pro includes a unique feature called Developer Mode. When Developer mode is enabled WPtouch Pro will load on ALL browsers. You can enable Developer Mode for your Mobile theme or your iPad theme via the menu General > Tools and Debug.

 

Lightbox scripts

last update : April 11, 2012

Lightbox is a simple, unobtrusive script (modal dialog box) used to overlay images on the current webpage. It’s a snap to setup and works on all modern browsers. Lightbox was developed by Lokesh Dhakar.

The current version is 2.0.5 released on March 18th, 2011. It’s based on the Prototype Javascript  Framework and on script.aculo.us. There are specific modified versions available like ThickBox (developed by Cody Lindley, but no longer maintained), LyteBox (version 5.5, released on January 26, 2012 by Markus F. Hay) and others. Different plugin’s are available for WordPress.

A very minimal implementation of a lightbox (modal dialog box) is available at the Google code website. More scripts about modal dialog boxes are listed at the Designlabel website.

My favorite script is Lytebox developped by Markus F. Hay. Based on the Lightbox class that Lokesh Dhakar originally wrote, the purpose was to write a self-contained object that eliminated the dependency of the javascript frameworks prototype.js, effects.js, and scriptaculous.js. Lytebox supports iFrames.  Since the original version of Lytebox, major modifications were added as a result of user input to improve performance as well as slideshow support, themes support, HTML content support and many more configurable options that allow you to customize the look and feel of the software.

More informations about modal dialog boxes are available at the following links :

Standalone scripts :

jQuery based scripts :

Miscellanous :

WordPress plugin & theme development

WordPress Codex provides a huge documentation for programmers who want to develop plugins or themes for the WordPress Blog program.

WordPress Plugin: A WordPress Plugin is a set of one or more functions, written in the PHP scripting language, that adds a specific set of features or services to the WordPress weblog, which can be seamlessly integrated with the weblog using access points and methods provided by the WordPress API.

Resources :

WordPress Theme : A WordPress Theme is a collection of files that work together to produce a graphical interface with an underlying unifying design for a weblog. These files are called template files. A Theme modifies the way the site is displayed, without modifying the underlying software. Themes may include customized template files, image files, style sheets, custom pages, as well as any necessary code files and scripts.

Resources :

WordPress Templates : Template files are the building blocks of your WordPress site. They fit together like the pieces of a puzzle to generate the web pages on your site. Some templates are used on all the web pages, while others are used only under specific conditions.

Resources :