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 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.