Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // A function that returns all staff members in an unordered list
- function mod_get_staff($scope, $size) {
- if ('all' == $scope) :
- $the_terms = get_terms('people'); // get all of the terms in the people taxonomy
- elseif ( 'post' == $scope ) : // get only the terms connected to this post
- global $post;
- $the_terms = get_the_terms($post->ID, 'people');
- else :
- return;
- endif;
- $fakeuser = array( // this is an array of images for use when no image exists
- 'mystery_1' => get_bloginfo('stylesheet_directory') . "/library/images/mysteryman/user-1.png",
- 'mystery_2' => get_bloginfo('stylesheet_directory') . "/library/images/mysteryman/user-2.png",
- 'mystery_3' => get_bloginfo('stylesheet_directory') . "/library/images/mysteryman/user-3.png"
- );
- $output = "<ul class='team-bios'>";
- foreach ($the_terms as $key => $value) { // for each term, execute the following loop
- $thesize = $size; // use the thumbnail image, if available
- $image_obj = s8_get_taxonomy_image_src($the_terms[$key], $thesize); // Grab the taxonomy image object
- if ( !empty($image_obj)) : // check if the image object is empty
- $image_src = $image_obj['src']; // grab the URL of the taxonomy image for this term
- else :
- $image_src = $fakeuser[array_rand($fakeuser)]; // if no image is available, use a the placeholder array
- endif;
- $output .= "<li>";
- $output .= "<img class='modiodojo' src='$image_src' alt='$value->name | $value->description' /><br />";
- $output .= "<div class='imageover'>"; // CSS overlay containing the taxonomy information
- $output .= "<h3>$value->name</h3>"; // This is the name of the taxonomy
- $output .= "<p>$value->description</p>"; // We use the description as the person's title in this example
- $output .= "</div>";
- $output .= "</li>";
- }
- $output .= "</ul>";
- echo $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement