How To Make Simple Staff List Single Staff Member Templates Work With Your Theme

Now that Simple Staff List has support for single Staff Member pages – you’ll need to make them fit in with your theme. This is really much easier than it sounds – I’ll walk you through it.

Now, as I said in my introductory post about single Staff Member pages, you don’t need to do anything for the default WordPress themes (Twenty Seventeen, Twenty Sixteen, etc.). But that doesn’t help if you’re not using one of those themes does it? Here’s how to add support for whichever theme your website is using.

Let’s say you’re using a child theme for the OceanWP theme – one of the most popular free themes available in the WordPress.org theme repository. If you look at one of the single Staff Member pages you’ll see something like this:

The code shown below is only applicable to the OceanWP theme but you can apply this same thinking to any WordPress theme.

While it doesn’t look terrible it’s definitely not ideal and probably doesn’t look anything like the other posts on your site. To fix this, we’ll start by creating a new folder in your theme called sslp-templates. Then make a global folder inside sslp-templates/ you just created. We’ll create the files wrapper-start.php and wrapper-end.php inside the global folder to make our single Staff Member pages look right.

Next, we need to look in the theme and find the template files that are being used to display a single post. For the OceanWP theme, that’s oceanwp/singular.php and should look something like this:

oceanwp/singular.php

For wrapper-start.php we’ll need everything from 
<?php do_action( 'ocean_before_content_wrap' ); ?> down to <?php do_action( 'ocean_before_content_inner' ); ?>. So copy all of that and place it into wrapper-start.php in your theme’s sslp-templates/global folder.

wrapper-start.php

For wrapper-end.php we’ll need everything from <?php do_action( 'ocean_after_content_inner' ); ?> down to <?php do_action( 'ocean_after_content_wrap' ); ?>. So copy all of that and place it into wrapper-end.php in your theme’s sslp-templates/global folder.

wrapper-end.php

Now, if you go look at a single Staff Member page, you’ll see it’s looking much better. The sidebar is back and there’s some space around the Staff Member content.

You could definitely stop here if you wanted, but this theme shows the post title above the post content, and we’re displaying it down under the staff photo so let’s fix that. In your theme’s `function.php` file add this code:

add_action( 'init', 'bas_remove_staff_template_parts' );
function bas_remove_staff_template_parts() {

	// Remove the Staff Member name - it's already being shown in this theme
	remove_action( 'sslp_single_staff_member_header', 'sslp_get_single_staff_member_name', 15 );

}

Here, we’re just removing the Staff Member name from the single Staff Member header area since it’s already being shown elsewhere by the theme. And with that, we now have a nice looking single Staff Member page with our theme.

“But, Brett! I can’t add files to my theme because <INSERT VERY GOOD REASON HERE>!” Well, if you can’t add these template files to you theme, you can still write yourself a custom plugin to achieve the same result. Check out my tutorial for overriding Simple Staff List template files using a plugin.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Brett Shumaker

Subscribe now to keep reading and get access to the full archive.

Continue reading