/** * This function shows the headline and description without thumbnails * @param [type] $posts the posts returned by WordPress * @param [type] $args the original arguments specified in the shortcode * @return [type] returns the html output */ function getpp_template_text($posts, $args) { $output = ''; $format = '<p><a href="%1$s"><h4 class="media-heading">%2$s</h4></a>%3$s</p>'; global $post; $urlid = get_the_ID(); foreach ($posts as $post) { setup_postdata($post); if (getpp_depth_permitted($args['depth'], getpp_depth($urlid, $post->ID))) { $vars['href'] = get_permalink($post->ID); $vars['title'] = $post->post_title; $vars['excerpt'] = get_the_excerpt(); $output .= vsprintf($format, $vars); } } wp_reset_postdata(); return $output; }
/** * This function shows thumbnails with title per http://getbootstrap.com/components/#media * @param [type] $posts the posts returned by WordPress * @param [type] $args the original arguments specified in the shortcode * @return [type] returns the html output */ function getpp_template_highlights($posts, $args) { $output = ''; $format = '<div class="media">%1$s<div class="media-body"><a href="%2$s"><b class="media-heading">%3$s</b></a></div></div>'; global $post; $urlid = get_the_ID(); foreach ($posts as $post) { setup_postdata($post); if (getpp_depth_permitted($args['depth'], getpp_depth($urlid, $post->ID))) { $vars['img'] = get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'media-object pull-left span1')); $vars['href'] = get_permalink($post->ID); $vars['title'] = $post->post_title; $output .= vsprintf($format, $vars); } } wp_reset_postdata(); return $output; }
/** * This template shows thumbnails with titles per http://getbootstrap.com/components/#thumbnails * @param [type] $posts the posts returned by WordPress * @param [type] $args the original arguments specified in the shortcode * @return [type] returns the html output */ function getpp_template_thumbnails($posts, $args) { $output = ''; $format = '<div class="col-xs-6 col-md-3"><a class="thumbnail" href="%2$s">%3$s<div class="text-center">%1$s</div></a></div>'; global $post; $urlid = get_the_ID(); foreach ($posts as $post) { setup_postdata($post); if (getpp_depth_permitted($args['depth'], getpp_depth($urlid, $post->ID))) { $excerpt = get_the_excerpt(); $vars['title'] = $post->post_title; $vars['href'] = get_permalink($post->ID); $vars['img'] = get_the_post_thumbnail($post->ID, 'thumbnail', array('alt' => $excerpt, 'title' => $vars['title'])); $output .= vsprintf($format, $vars); } } wp_reset_postdata(); return '<div class="row">' . $output . '</div>'; }
/** * This function renders a simple list of posts in a Bootstrap styled format. You can override this with your own filter. See remove_filter and add_filter in the codex. * @param [type] $posts the posts returned by WordPress * @param [type] $args the original arguments specified in the shortcode * @return [type] returns the html output */ function getpp_template_default($posts, $args) { $output = '<ul style="padding:0" class="nav nav-list">'; $format = '<li id="%1$s" class="%5$s"><a style="border: 1px solid #e5e5e5; margin: auto auto -1px;" href="%2$s"><i class="icon-chevron-right pull-right"></i>%4$s%3$s</a></li>'; global $post; $urlid = get_the_ID(); foreach ($posts as $post) { setup_postdata($post); if (getpp_depth_permitted($args['depth'], getpp_depth($urlid, $post->ID))) { $vars['id'] = 'post-' . $post->ID; $vars['href'] = get_permalink($post->ID); $vars['title'] = $post->post_title; $vars['indent'] = str_repeat('» ', getpp_depth($urlid, $post->ID) - 1); $vars['css'] = $post->ID == get_the_ID() ? 'active' : ''; $output .= vsprintf($format, $vars); } } wp_reset_postdata(); $output .= '</ul>'; return $output; }