Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi Ricky,
    Right now I don’t have support for showing a single staff member by ‘id’ but you could use the groups feature. Just create a group named ‘Featured’ or whatever and the only add one staff member to that group and use [simple-staff-list group="Featured"] and that will display the one staff member on that page.

    I do plan on adding support for showing a staff member by id in the future.

    Thanks!
    Brett

    Thread Starter rickyspires

    (@rickyspires)

    Thats great.

    Another cool feature would be a lightbox. so the list only shows the image and name then if you click the image you get a pop up with the rest ??

    rick ??

    Plugin Author Brett Shumaker

    (@brettshumaker)

    You might be able to achieve this using a lightbox plugin. You could use your own link code around the staff image url and then put the staff details in the img alt attribute. This would show the staff photo again, though.

    Or you could just do it all with your own javascript. In your staff loop you would show the staff image and then wrap the staff info in a hidden div. Style that hidden div and then show it on click of the staff image.

    Thread Starter rickyspires

    (@rickyspires)

    well.

    im trying to create a list of staff that open in a light box.

    i have installed a lightbox plug and created each member as a group so i can open the one member of staff in the lightbox.

    in the lightbox i want to show all the staff info but in the list i only want to show only the image and title. i think i will have to hide sections using js ??

    thanks

    I have a site I am building a for a teen girl’s softball team, here:
    https://socalknuckleup.com/

    You can see on the home page that we’re trying to add a list of team management members, as clickable links to each person’s personal profile. In order to create this kind of list I had to alter the list template as follows:

    [staff_loop]
    <a href="https://socalknuckleup.com/staff-members/[staff-name]" title="[staff-name] : [staff-position]">
    <img class="staff-member-photo" src="[staff-photo-url]" alt="[staff-name] : [staff-position]">
    [staff-position] : <b>[staff-name]</b>
    </a>
    [/staff_loop]

    … then add jQuery to replace any blanks in the [staff-name] part of the link URL with dashes, thereby achieving a list of proper post-name clickable links to each staff member profile.

    I could not see an easier way to do this. SO…

    Q.1 — is there an easier way to do this?
    Q.2 — how can I modify the individual staff member post type output to show all their profile information?

    In other words I simply want to achieve a clickable list of staff members, each item of which goes to a proper staff-member full profile, contact info & bio page.

    Thank you,

    XIMBALO

    Ximbalo,

    This thread is marked as resolved. Please ask your questions in your own thread so that if people are looking for the same answer they will see it by your title and not the one created by ricky. Your thread is related but a different result is wanted.

    In the file user-view-show-staff-list.php I duplicated the function, renamed it and adapted it for one-staffmember-use. Works perfectly. Just call the function with the ID of the person in brackets:

    function sslp_staff_member_shortcode_func($atts) {
    
    	extract(shortcode_atts(array(
    	  'single' => 'yes',
    	  'wrap_class' => '',
    	), $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, 'p' => $atts, 'post_status' => 'publish' );
    
    	$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		= 'https://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>';
    		}
    
    		$email_mailto = '<a class="staff-member-email" href="mailto:'.antispambot( $email ).'" title="Email '.$name.'">'.antispambot( $email ).'</a>';
    		$email_nolink = antispambot( $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_shortcode_func');

    angelozehr, can you show us what the shortcode looks like for that please? Is it supposed to be:
    [simple-staff-list id="1"]

    doesn’t work

    [simple-staff-list="159"]

    doesn’t work

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Show individual member of staff from list by id’ is closed to new replies.