function term_slug()
 {
     global $post;
     $name = single_term_title();
     $terms = get_the_terms($post->ID, $name);
     if ($terms && !wp_error($terms)) {
         foreach ($terms as $term) {
             echo $term->slug;
         }
     }
 }
Esempio n. 2
0
function add_user_points_votes($commentID, $type)
{
    global $wpdb, $table_prefix;
    $table_name = $table_prefix . 'user_points';
    //$user = wp_get_current_user();
    $comment = get_comment($commentID);
    $userID = $comment->user_id;
    $currentTheme = wp_get_theme();
    $themeName = str_replace(' ', '_', strtolower($currentTheme->Name));
    $opt = wp_load_alloptions();
    $up_opt = unserialize($opt['up_themes_' . $themeName]);
    $points = (int) $up_opt['points_per_vote'];
    if ($type == 'down') {
        $points = $points * -1;
    }
    $wpdb->query('INSERT into ' . $table_name . ' (user_id, points) VALUES ("' . $userID . '", "' . $points . '") ON DUPLICATE KEY UPDATE points=points+' . $points) or die(wp_error());
}