function section_template() { $align = $this->opt('align'); if ($align == 'left') { $align_class = 'alignleft'; } elseif ($align == 'right') { $align_class = 'alignright'; } else { $align_class = ''; } $txt = $this->opt('text'); $txt = $txt ? sprintf('<div class="txt-wrap pla-from-bottom pl-animation subtle"><div class="txt">%s</div></div>', $txt) : ''; ?> <div class="pl-sharebar"> <div class="pl-sharebar-pad"> <div class="pl-social-counters pl-animation-group <?php echo $align_class; ?> "> <?php $classes = 'pl-animation pla-from-top subtle icon'; echo pl_karma(false, array('classes' => $classes)); foreach ($this->the_icons() as $key => $icon) { if (!pl_setting($this->id . '_disable_' . $icon)) { echo pl_get_social_button(array('btn' => $icon, 'classes' => $classes)); } } ?> </div> <?php echo $txt; ?> <div class="clear"></div> </div> </div> <?php }
/** * Produces a karma counter for post * * @example <code>[pl_karma]</code> is the default usage */ function pl_karma_shortcode($atts) { global $post; if (!isset($post)) { return; } $defaults = array('classes' => '', 'post' => '', 'icon' => ''); $atts = shortcode_atts($defaults, $atts); return pl_karma(false, $atts); }
function section_template() { global $post; $post_type = $this->opt('flipper_post_type') ? $this->opt('flipper_post_type') : 'post'; $pt = get_post_type_object($post_type); $shown = $this->opt('flipper_shown') ? $this->opt('flipper_shown') : '3'; $total = $this->opt('flipper_total') ? $this->opt('flipper_total') : '10'; $title = $this->opt('flipper_title') ? $this->opt('flipper_title') : $pt->label; $hide_link = $this->opt('flipper_hide_title_link') ? true : false; $show_excerpt = $this->opt('flipper_show_excerpt') ? $this->opt('flipper_show_excerpt') : false; $disable_show_love = $this->opt('disable_flipper_show_love') ? true : false; $format = $this->opt($this->id . '_format') ? $this->opt($this->id . '_format') : 'grid'; $meta = $this->opt('flipper_meta') ? $this->opt('flipper_meta') : '[post_date] [post_edit]'; $sizes = $this->opt('flipper_sizes') ? $this->opt('flipper_sizes') : 'aspect-thumb'; $sorting = $this->opt('flipper_post_sort') ? $this->opt('flipper_post_sort') : 'DESC'; $orderby = 'rand' == $this->opt('flipper_post_sort') ? 'rand' : 'date'; $the_query = array('posts_per_page' => $total, 'post_type' => $post_type, 'orderby' => $orderby, 'order' => $sorting); if ($this->opt('flipper_meta_key') && $this->opt('flipper_meta_key') != '' && $this->opt('flipper_meta_value')) { $the_query['meta_key'] = $this->opt('flipper_meta_key'); $the_query['meta_value'] = $this->opt('flipper_meta_value'); } if ($this->opt('flipper_category') && $this->opt('flipper_category') != '') { $cat = get_category_by_slug($this->opt('flipper_category')); $the_query['category'] = $cat->term_id; } $posts = get_posts($the_query); if (!empty($posts)) { setup_postdata($post); ?> <?php if (!$this->opt($this->id . '_hide_nav')) { ?> <div class="flipper-heading"> <div class="flipper-heading-wrap"> <div class="flipper-title pl-standard-title"> <?php echo $title; $archive_link = get_post_type_archive_link($post_type); if ($archive_link && !$hide_link) { printf('<a href="%s" > %s</a>', $archive_link, __(' / View All', 'pagelines')); } else { if ($post_type == 'post' && get_option('page_for_posts') && !is_home() && !$hide_link) { printf('<a href="%s" > %s</a>', get_page_uri(get_option('page_for_posts')), __(' / View Blog', 'pagelines')); } } ?> </div> <a class="flipper-prev pl-contrast" href="#"><i class="icon icon-angle-left"></i></a> <a class="flipper-next pl-contrast" href="#"><i class="icon icon-angle-right"></i></a> </div> </div> <?php } ?> <div class="flipper-wrap"> <ul class="row flipper-items text-align-center layout-<?php echo $format; ?> flipper" data-scroll-speed="800" data-easing="easeInOutQuart" data-shown="<?php echo $shown; ?> "> <?php } ?> <?php if (!empty($posts)) { foreach ($posts as $post) { setup_postdata($post); ?> <li style=""> <div class="flipper-item fix"> <?php if (has_post_thumbnail()) { echo get_the_post_thumbnail($post->ID, $sizes, array('title' => '')); } else { printf('<img height="400" width="600" src="%s" alt="no image added yet." />', pl_default_image()); } ?> <div class="flipper-info-bg"></div> <a class="flipper-info pl-center-inside" href="<?php echo get_permalink(); ?> "> <div class="pl-center-table"><div class="pl-center-cell"> <?php if ($format == 'masonry') { ?> <h4> <?php the_title(); ?> </h4> <div class="metabar"> <?php echo do_shortcode('[post_date]'); ?> </div> <?php } else { ?> <div class="info-text"><i class="icon icon-link"></i></div> <?php } ?> </div></div> </a> </div><!--work-item--> <?php if ($format == 'grid') { ?> <div class="flipper-meta"> <?php if (!$disable_show_love) { echo pl_karma($post->ID); } ?> <h4 class="flipper-post-title"><a href="<?php echo get_permalink(); ?> "><?php the_title(); ?> </a></h4> <div class="flipper-metabar"><?php echo do_shortcode(apply_filters('pl_flipper_meta', $meta, $post->ID, pl_type_slug())); ?> </div> <?php if ($show_excerpt) { ?> <div class="flipper-excerpt pl-border"> <?php the_excerpt(); ?> </div> <?php } ?> </div> <?php } ?> <div class="clear"></div> </li> <?php } } if (!empty($posts)) { echo '</ul></div>'; } // wp_reset_query(); }
function section_template() { global $post; $show_excerpt = $this->opt($this->id . '_excerpt', array('default' => false)); $format = $this->opt($this->id . '_format', array('default' => 'masonry')); $gutter_class = $format == 'grid' ? 'with-gutter' : ''; $post_type = $this->opt($this->id . '_post_type', array('default' => 'post')); $pt = get_post_type_object($post_type); $total = $this->opt($this->id . '_total', array('default' => 10)); $meta = $this->opt($this->id . '_meta', array('default' => '[post_date] [post_edit]')); if ($this->opt($this->id . '_sizes') && $this->opt($this->id . '_sizes') != '') { $sizes = $this->opt($this->id . '_sizes'); } elseif ($format == 'masonry') { $sizes = $this->get_masonry_image_size(); } else { $sizes = 'aspect-thumb'; } $sorting = $this->opt($this->id . '_post_sort', array('default' => 'DESC')); $orderby = 'rand' == $sorting ? 'rand' : 'date'; $the_query = array('posts_per_page' => $total, 'post_type' => $post_type, 'orderby' => $orderby, 'order' => $sorting); if ($this->opt($this->id . '_meta_key') && $this->opt($this->id . '_meta_key') != '' && $this->opt($this->id . '_meta_value')) { $the_query['meta_key'] = $this->opt($this->id . '_meta_key'); $the_query['meta_value'] = $this->opt($this->id . '_meta_value'); } $filter_tax = $this->opt($this->id . '_category', array('default' => 'category')); $posts = get_posts($the_query); $filters = array(); foreach ($posts as $post) { $terms = wp_get_post_terms($post->ID, $filter_tax); foreach ($terms as $t) { $filters[$t->slug] = $t->name; } } $args = array('taxonomy' => $filter_tax); $list = get_categories($args); if (is_array($list) && !empty($list)) { foreach ($list as $key => $l) { if (!isset($filters[$l->slug])) { unset($list[$key]); } } } $default_title = $this->opt('default_title') ? $this->opt('default_title') : 'All'; if (!empty($posts)) { ?> <div class="masonic-wrap"> <div class="masonic-header pl-area-ui-element"> <div class="masonic-header-wrap pl-content"> <div class="masonic-header-content-pad fix"> <div class="masonic-title"><?php echo $default_title; ?> </div> <ul class="masonic-nav inline-list"> <lh>Sort:</lh> <li class="pl-link"><a href="#" data-filter="*">All</a></li> <?php if (is_array($list) && !empty($list)) { foreach ($list as $key => $l) { printf('<li><a href="#" data-filter=".%s">%s</a></li>', $l->slug, ucwords($l->name)); } } ?> </ul> </div> </div> </div> <ul class="masonic-gallery row row-set <?php echo $gutter_class; ?> no-transition" data-format="<?php echo $format; ?> "> <?php } ?> <?php if (!empty($posts)) { $item_cols = 3; $count = 1; $total = count($posts); foreach ($posts as $post) { setup_postdata($post); $filters = wp_get_post_terms($post->ID, $filter_tax); $filter_classes = array(); if (is_array($filters) && !empty($filters)) { foreach ($filters as $f) { $filter_classes[] = $f->slug; } } // echo pl_grid_tool('row_start', $item_cols, $count, $total); ?> <li class="span3 <?php echo join(' ', $filter_classes); ?> "> <div class="span-wrap pl-grid-wrap"> <div class="pl-grid-image fix"> <?php if (has_post_thumbnail()) { echo get_the_post_thumbnail($post->ID, $sizes, array('title' => '')); } else { printf('<img src="%s" alt="no image added yet." />', pl_default_image()); } ?> <div class="pl-grid-image-hover"></div> <a class="pl-grid-image-info" href="<?php echo get_permalink(); ?> "> <div class="pl-center-table"><div class="pl-center-cell"> <?php if ($format == 'masonry') { ?> <h4> <?php the_title(); ?> </h4> <div class="metabar"> <?php echo do_shortcode('[post_date]'); ?> </div> <?php } else { ?> <div class="info-text"><i class="icon icon-link"></i></div> <?php } ?> </div></div> </a> </div><!--work-item--> <?php if ($format == 'grid') { ?> <div class="pl-grid-content fix"> <div class="fix"> <div class="pl-grid-meta"> <?php echo pl_karma($post->ID); ?> </div> <div class="pl-grid-text"> <h4> <a href="<?php echo get_permalink(); ?> "> <?php the_title(); ?> </a> </h4> <div class="pl-grid-metabar"> <?php echo do_shortcode($meta); ?> </div> </div> </div> <?php if ($show_excerpt) { ?> <div class="pl-grid-excerpt pl-border"> <?php the_excerpt(); ?> </div> <?php } ?> </div> <?php } ?> <div class="clear"></div> </div> </li> <?php //echo pl_grid_tool('row_end', $item_cols, $count, $total); $count++; } } if (!empty($posts)) { echo '</ul></div>'; } // wp_reset_query(); }