Hey brettbum –
The solution to this is pretty complex, and it’s a feature that we’ll be adding to the plugin in the future. I don’t know your skill set so forgive me if I’m talking over your head or down to you a little bit. 🙂
A little background – a staff member is really just a custom post type with custom meta data. So if you’ve made a custom page template for a custom post type before, you’ll do exactly the same thing.
First thing you need to do is to create a copy of the single.php file in your theme directory and rename it single-staff-member.php. This will serve as the template file for the individual staff page.
Next, you’re going to put in some custom PHP code where you see <?php the_content(); ?> in the template file. **Note that this may look different depending on your theme. It may be something like `<?php get_template_part( ‘single’, ‘content’); ?>** Here’s the code we use in the plugin to get all of the custom data about the staff member:
$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 = '';
}
This just sets up all the data for the staff member into PHP variables, nothing is displayed with the above code. To display that information, just build out your HTML and drop in those PHP variables where ever you need them. The exact HTML used will largely depend on the design of your site and how you want your single staff member pages laid out.
So to output the staff bio, for example, may look something like this:
<div class="staff-member-bio"><?php echo wpautop($bio); ?></div>
Make sense? Have any questions?
Hi BrettShum… I’m also following this thread, but it seems I’m at a dead end for my skills at this time. Here’s what I see with your plugin. Any suggestions you have are welcome, and thanks!
Working with Avada theme, I can create listings of staff, the individual posts of staff are searchable via site search, but the page comes up a 404 when clicked. Examples on this development server:
Staff directory example:
http://dev.testcmcla.org/testsimplestafflist/
Individual staff member sample:
http://dev.testcmcla.org/staff-members/g-foreman/
Since you do not provide a functional custom single post template in your plugin, we have false positives in our site search. This is different than what Leslie had in her example (which shows a single post page with a title, but no content.)
Example: someone looks for George Foreman in our site search.
http://dev.testcmcla.org/?s=george+foreman
Top result is “George Foreman” (a Staff Member custom post type). If they click on that link, they get a 404, making the whole exercise quite negative for some patrons (and eventually showing up negative in Google stats as well.)
If I want to use your plugin, either I
— have to learn custom post type template building in a hurry (and do it within the heavily-featured Avada theme framework), or
— figure out whether I can change the core to screen out this post type from our site search.
Is this a “feature” instead of a bug? Let me know if I’ve missed the point. Perhaps this is part of what your crew in Nashville might put on their dev list for the future?
Unfortunately, the search issue is a dealbreaker for us. I’ll have to go back to manually creating the directory without other leads to follow. Thanks for working on WP!