Sorry, I forgot to check e-mail notification. I think the crash may be related to the class name. I tend to prefix all my classes and variables, but removed the prefix before I posted the code, so there’s likely a namespace conflict. Try renaming the class to MyStaffMember or whatever suits you.
The class is intended to be used to retrieve information about a single staff member for use in the single-staff-member.php, it will not work in other contexts.
What it does is that it allows you to access the data about your staff member (e.g., phone number, email etc.) via class properties, so rather than saying, e.g.:
$custom = get_post_custom();
$title = $custom["_staff_member_title"][0];
You can say:
$member = new SomePrefix__StaffMember();
$title = $member->title;
Of course, the great thing is that there is no longer a need to define a variable for each field.
There are also some convienience functions, namely, show() and mailto():
show() will print the requested field, inside a <span> tag (or another tag which you can specify as 2nd argument), assigning a DOM (not PHP) class of the form “staff-member-$FIELD” where $FIELD is replaced with the name of the field printed (you can pass a third argument to show() to assign a different DOM class name).
mailto() will simply print out a mailto link with the email address “encrypted” by WordPress’ antispambot() function. If you access the email address via show() or the email property of the StaffMember class, it will not be “encrypted”.
So to give you an example, this is how my single-staff-member.php looks like (note the prefixes).
<?php
/**
* The Template for displaying staff members
*
* See https://www.ads-software.com/support/topic/link-to-staff-member-page
*/
$rockingthevorstand__single_staff_member_obj = new rockingthevorstand__StaffMember();
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<article class="staff-member staff-member-single type-staff-member">
<header class="entry-header staff-member-header">
<h1 class="entry-title"><?php echo get_the_title(); ?></h1>
<?php $rockingthevorstand__single_staff_member_obj->show( "title", "div" ); ?>
</header>
<div class="entry-content">
<?php if(has_post_thumbnail()): ?>
<div class="staff-member-photo">
<img class="staff-member-photo" height="180" width="150"
src="<?php echo wp_get_attachment_url(get_post_thumbnail_id()); ?>"
alt="<?php echo get_the_title(); ?>" />
</div>
<?php endif; ?>
<div class="staff-member-content">
<?php if($rockingthevorstand__single_staff_member_obj->email) :?>
<div class="staff-member-email"><strong>E-Mail:</strong>
<?php $rockingthevorstand__single_staff_member_obj->mailto(); ?>
</div>
<?php endif; ?>
<?php $rockingthevorstand__single_staff_member_obj->show( "bio", "div" ); ?>
</div>
</div>
</article>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>