mercredi 25 mars 2015

Manage users custom column add class "num"


I have customized my admin users column to show the purchased leads of a role "lead buyer". The value of the column is a decimal (the number of leads).


The "posts" column of the users table has a class "num" so the <th> and the <td> are styled with text-align: center;.


I want to add a the "num" class to my custom column too.


Does anyone know in which document you can find the "manage_users_columns" and "manage_users_custom_columns" functions to see if there is a possibility to add the class "num"?


Purchased leads column needs to be aligned center


The class num on the "posts" column



// Add users table header columns
add_filter( 'manage_users_columns', 'gtp_users_table_columns' );
function gtp_users_table_columns( $defaults ) {
$defaults['purchased-leads'] = __( 'Purchased leads', 'gtp_translate' );
return $defaults;
}

// Add users table lead purchase column content
add_action( 'manage_users_custom_column', 'gtp_users_table_content', 10, 3 );
function gtp_users_table_content( $value, $column_name, $user_id ) {
$leads = gtp_get_leads_by_buyer( $user_id );
switch( $column_name ) {
case 'purchased-leads' :
return $leads->found_posts;
break;

}
}




Aucun commentaire:

Enregistrer un commentaire