function sc_person_picture_list($atts) { $atts['type'] = $atts['type'] ? $atts['type'] : null; $row_size = $atts['row_size'] ? intval($atts['row_size']) : 5; $categories = $atts['categories'] ? $atts['categories'] : null; $org_groups = $atts['org_groups'] ? $atts['org_groups'] : null; $limit = $atts['limit'] ? intval($atts['limit']) : -1; $join = $atts['join'] ? $atts['join'] : 'or'; $people = sc_object_list(array('type' => 'person', 'limit' => $limit, 'join' => $join, 'categories' => $categories, 'org_groups' => $org_groups), array('objects_only' => True)); ob_start(); ?> <div class="person-picture-list"><?php $count = 0; foreach ($people as $person) { $image_url = get_featured_image_url($person->ID); $link = $person->post_content != '' ? True : False; if ($count % $row_size == 0) { if ($count > 0) { ?> </div><?php } ?> <div class="row"><?php } ?> <div class="span2 person-picture-wrap"> <?php if ($link) { ?> <a href="<?php echo get_permalink($person->ID); ?> "><?php } ?> <img src="<?php echo $image_url ? $image_url : get_bloginfo('stylesheet_directory') . '/static/img/no-photo.jpg'; ?> "> <div class="name"><?php echo Person::get_name($person); ?> </div> <div class="title"><?php echo get_post_meta($person->ID, 'person_jobtitle', True); ?> </div> <?php if ($link) { ?> </a><?php } ?> </div> <?php $count++; } ?> </div> </div> <?php return ob_get_clean(); }
/** * Shortcode for this custom post type. Can be overridden for descendants. * Defaults to just outputting a list of objects outputted as defined by * toHTML method. **/ public function shortcode($attr) { $default = array('type' => $this->options('name')); if (is_array($attr)) { $attr = array_merge($default, $attr); } else { $attr = $default; } return sc_object_list($attr); }