Skip to content

Instantly share code, notes, and snippets.

@gogrw
gogrw / gist:b4f4b549955d56970ea32b33ba8af1e1
Created May 13, 2019 14:09
Shortcode for Listing Users from Meta Data - Passing Merge Tags Through Parameters
/**
* Shortcode for Listing Users from Meta Data
* Usage: [list_users key="{report_type:3}" value="{which_report:1}" userrole="{which_state:2}"]
*/
function users_from_meta($atts) {
$atts = shortcode_atts( array(
'key' => '',
'value' => '',
'userrole' => '',
), $atts );
@gogrw
gogrw / gist:666d17105e99b9f98a2bbe2697a8f343
Created May 13, 2019 14:11
Shortcode for Listing Users from Meta Data - Without Parameters
/**
* Shortcode for Listing Users from Meta Data on PDF REPORT
* Usage: [list_users_pdf]
*/
function pdf_users_from_meta() {
$user_query = new WP_User_Query( array(
'meta_key' => '{report_type:3}',
'meta_value' => '{which_report:1}',
'role__in' => wp_parse_list( '{which_state:2:value}' ),
) );