public
Last active

Fix Simple Staff List to work with other email encoding plguins Support Thread: http://wordpress.org/support/topic/patch-fix-compatibility-issue-with-cryptx e.g. CryptX http://wordpress.org/plugins/cryptx/

  • Download Gist
user-view-show-staff-list.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
<?php
 
function sslp_staff_member_listing_shortcode_func($atts) {
extract(shortcode_atts(array(
'single' => 'no',
'group' => '',
'wrap_class' => '',
'order' => 'ASC',
), $atts));
// Get Template and CSS
$custom_html = stripslashes_deep(get_option('_staff_listing_custom_html'));
$custom_css = stripslashes_deep(get_option('_staff_listing_custom_css'));
$default_tags = get_option('_staff_listing_default_tags');
$default_formatted_tags = get_option('_staff_listing_default_formatted_tags');
$output = '';
$group = strtolower($group);
$order = strtoupper($order);
$staff = '';
$use_external_css = get_option('_staff_listing_write_external_css');
/**
* Set up our WP_Query
*/
$args = array( 'post_type' => 'staff-member', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'post_status' => 'publish' );
// Check user's 'order' value
if ($order != 'ASC' && $order != 'DESC') {
$order = 'ASC';
}
// Set 'order' in our query args
$args['order'] = $order;
$args['staff-member-group'] = $group;
$staff = new WP_Query( $args );
/**
* Set up our loop_markup
*/
$loop_markup = $loop_markup_reset = str_replace("[staff_loop]", "", substr($custom_html, strpos($custom_html, "[staff_loop]"), strpos($custom_html, "[/staff_loop]") - strpos($custom_html, "[staff_loop]")));
// Doing this so I can concatenate class names for current and possibly future use.
$staff_member_classes = $wrap_class;
// Prepare to output styles if not using external style sheet
if ( $use_external_css == "no" ) {
$style_output = '<style>'.$custom_css.'</style>';
}
$i = 0;
if( $staff->have_posts() ) {
$output .= '<div class="staff-member-listing '.$group.'">';
while( $staff->have_posts() ) : $staff->the_post();
if ($i == ($staff->found_posts)-1) {
$staff_member_classes .= " last";
}
if ($i % 2) {
$output .= '<div class="staff-member odd '.$staff_member_classes.'">';
} else {
$output .= '<div class="staff-member even '.$staff_member_classes.'">';
}
global $post;
$custom = get_post_custom();
$name = get_the_title();
$name_slug = basename(get_permalink());
$title = $custom["_staff_member_title"][0];
$email = $custom["_staff_member_email"][0];
$phone = $custom["_staff_member_phone"][0];
$bio = $custom["_staff_member_bio"][0];
$fb_url = $custom["_staff_member_fb"][0];
$tw_url = 'http://www.twitter.com/' . $custom["_staff_member_tw"][0];
if(has_post_thumbnail()){
$photo_url = wp_get_attachment_url( get_post_thumbnail_id() );
$photo = '<img class="staff-member-photo" src="'.$photo_url.'" alt = "'.$title.'">';
}else{
$photo_url = '';
$photo = '';
}
if (function_exists('wpautop')){
$bio_format = '<div class="staff-member-bio">'.wpautop($bio).'</div>';
}
/*
Allow override of default email encoding
add_filter('sslp_encode_emails','__return_false'); //turn off encoding
*/
$encode_emails = true;
$encode_emails = apply_filters( 'sslp_encode_emails', $encode_emails );
if( $encode_emails )
$email = antispambot( $email );
$email_mailto = '<a class="staff-member-email" href="mailto:'. $email .'" title="Email '.$name.'">'. $email .'</a>';
$email_nolink = $email;
$accepted_single_tags = $default_tags;
$replace_single_values = array($name, $name_slug, $photo_url, $title, $email_nolink, $phone, $bio, $fb_url, $tw_url);
$accepted_formatted_tags = $default_formatted_tags;
$replace_formatted_values = array('<h3 class="staff-member-name">'.$name.'</h3>', '<h4 class="staff-member-position">'.$title.'</h4>', $photo, $email_mailto, $bio_format );
$loop_markup = str_replace($accepted_single_tags, $replace_single_values, $loop_markup);
$loop_markup = str_replace($accepted_formatted_tags, $replace_formatted_values, $loop_markup);
$output .= $loop_markup;
$loop_markup = $loop_markup_reset;
$output .= '</div> <!-- Close staff-member -->';
$i += 1;
endwhile;
$output .= "</div> <!-- Close staff-member-listing -->";
}
wp_reset_query();
$output = $style_output.$output;
return do_shortcode($output);
}
add_shortcode('simple-staff-list', 'sslp_staff_member_listing_shortcode_func');
 
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.