Ejemplo n.º 1
0
function wptouch_exclude_tags($query)
{
    $excluded = wptouch_excluded_tags();
    if ($excluded) {
        $tags = explode(',', $excluded);
        $new_tags = array();
        foreach ($tags as $tag) {
            $new_tags[] = trim($tag);
        }
        $query->set('tag__not_in', $new_tags);
    }
    return $query;
}
Ejemplo n.º 2
0
function wptouch_ordered_tag_list($num)
{
    global $wpdb;
    if (wptouch_excluded_tags()) {
        $excluded_tags = wptouch_excluded_tags();
    } else {
        $excluded_tags = 0;
    }
    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>';
}