Support » Plugin: Staffer » Departments

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Edward R. Jenkins

    (@cardiganmedia)

    Not presently. One easy way to compartmentalize the main staff page would be to override the template (archive-staff.php) with your theme, and then build up different queries in your custom copy of that template to segment by taxonomy.

    It’s actually pretty easy! You just need to set up a quick loop…

    Here is the very simplified version:

    <?php
    
    query_posts('post_type=staff && department=YOURDEPARTMENTHERE');
    while (have_posts()) : the_post();
    
    // echo the staff member's values that you want displayed
    
    endwhile;
    ?>

    Just swap out YOURDEPARTMENTHERE with the department you want to target. Here’s an example from my project, each run through the loops spits out a division (for easy styling) which contains the specific staff members name, picture, and an excerpt of their bio:

    <?php
    
    query_posts('post_type=staff&&department=a');
    while (have_posts()) : the_post();
    
    echo '<div class="staff">';
    
    echo '<h3><a href="';
    the_permalink();
    echo '">';
    the_title();
    echo '</a></h3>';
    
    the_post_thumbnail ( 'medium', array ('class' => 'alignleft') );
    the_excerpt();
    echo '</div>';
    
    endwhile;
    ?>

    I hope this helps you!!

    Plugin Author Edward R. Jenkins

    (@cardiganmedia)

    That’s a good example, nateweller. I want to expound on it a bit and would recommend using WP_Query() instead of query_posts() — such as:

    http://pastebin.com/mEtjZA4h

    This example uses the default Staffer markup, but your markup may vary. Just replace the department name with your own.

    Plugin Author Edward R. Jenkins

    (@cardiganmedia)

    With the new shortcode support, listings can be displayed by department inherently:

    https://www.edwardrjenkins.com/wordpress-plugins/staffer/#shortcodes

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Departments’ is closed to new replies.