Shortcode for displaying the user’s first name?
Shortcode for displaying the user’s first name?
Shortcode for displaying the user’s first name?
Mashable Follow is custom built for Mashable.com, so you won’t find a plugin that brings that level of integration to your WordPress site. That said, there are two that may suit your purpose: Social: Integrates your WordPress site with social networking sites Twitter and Facebook, thereby offering a whole lot of features including—automatically broadcasting posts … Read more
count_user_posts() doesn’t support the second parameter ($post_type in your code), according to the docs. There is a function at the bottom of the docs page that allows you do filter by post_type, you could drop in functions.php and use.
Sort users by custom user meta value
Paginate Links not working
Since the roles for a user are stored in (dbprefix)_capabilities, I’d try grabbing the database prefix and then using it to grab people with the right capabilities (caps are in a serialized array): global $wpdb; $prefix = $wpdb->prefix; $meta_name = “{$prefix}capabilities”; ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => “{$meta_name}” ‘value’ => ‘program_manager’, ‘compare’ … Read more
To sort by meta fields you need to use meta_key and meta_value (or meta_value_num): array( ‘meta_key’ => ‘sort_order’, //This is the custom field to orderby ‘orderby’ => ‘meta_value_num’, //for numerical values ‘role’ => ‘Administrator’, ‘fields’ => ‘all_with_meta’, ); However… This will probably order the results before your merge… so, instead of separate queries you can … Read more
The problem was due to the fact that the query was restructured in this latest update. As pointed out by d79 in this question, the query changed from: SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_users.* FROM wp_users INNER JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id ) INNER JOIN wp_usermeta AS mt1 ON ( wp_users.ID = mt1.user_id ) WHERE … Read more
In cases like this its better off (IHMO) to simple use a custom query using the $wpdb class ex: <?php global $wpdb; //first get a list of all meta keys $keys = $wpdb->get_col(“SELECT distinct meta_key FROM $wpdb->usermeta”); //then prepare the meta keys query as fields which we’ll join to the user table fields $meta_columns=””; foreach … Read more
WP_User_Query only accepts a single ‘role’ argument, and since your array has the same key twice only the second is getting used: array( ‘role’ => ‘vendor’, ‘role’ => ‘freevendor’, ); Is the same as: array( ‘role’ => ‘freevendor’, ); You could make two calls, one for each role set: $user_query_args = array ( ‘role’ => … Read more