_x( 'Type de badge', 'taxonomy general name' ),
'singular_name' => _x( 'Type de badge', 'taxonomy singular name' ),
'search_items' => __( 'Chercher un type de badge' ),
'all_items' => __( 'Tous les types de badge' ),
'parent_item' => __( 'Parent' ),
'parent_item_colon' => __( 'Parent :' ),
'edit_item' => __( 'Modifier le type de badge' ),
'update_item' => __( 'Sauvegarder le type de badge' ),
'add_new_item' => __( 'Ajouter un nouveau type de badge' ),
'new_item_name' => __( 'Nom du nouveau type' ),
'menu_name' => __( 'Type de badge' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'badge-type' ),
);
register_taxonomy( 'badge_type', array( 'mycred_badge' ), $args );
}
/**
* Count all Registered Users.
*/
function count_all_my_users() {
global $wpdb;
$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );
echo "{$user_count}";
}
/**
* Check if user has earned the Badge.
*/
function check_badge_status() {
// check if page visitor is logged_in or not
if ( is_user_logged_in() ) {
$user_id = get_current_user_id(); // get user_id of logged in visitor
$id = get_the_ID(); // get post_id
$value = get_metadata( 'user', $user_id, 'mycred_badge'.$id, true );
// check if the field has a value
if( ! empty( $value ) ) {
echo '
'; // earned add this
}
else {
echo '
'; // not earned add this
}
}
else {
echo '
'; // if visitor ins't logged_in add this
}
}
/**
* List all Badges based on their badge_type.
*/
function get_list_types_badges( $type ) {
global $post;
$args = array(
'order' => 'ASC', // ascending order, 1,2,3 (oldest post first)
'post_type' => 'mycred_badge', // search in the post type "mycred_badge"
'badge_type' => $type, // only list the badges assigned to the badge type entered
'post_status' => 'publish' // only list those who are publish, no drafts
);
$myposts = get_posts( $args );
echo '
Dire que pendant un temps je voulais te dépasser mais je suis loin du million.
Bientôt Dieu Ancien pour moi 😉
« Un Anneau pour les gouverner tous
Un Anneau pour les trouver
Un Anneau pour les amener tous,
Et dans les ténèbres les lier
Au pays de Mordor où s'étendent les ombres. »