Beispiel #1
0
function suffusion_display_single_featured_post($position, $excerpt_position)
{
    global $suf_featured_excerpt_type, $post, $suf_featured_center_slides, $suf_featured_stretch_w;
    if (isset($suf_featured_center_slides) && $suf_featured_center_slides == 'on') {
        $center = 'center';
    } else {
        $center = '';
    }
    if (isset($suf_featured_stretch_w) && $suf_featured_stretch_w == 'on') {
        $full_width = 'full-width';
    } else {
        $full_width = '';
    }
    $ret = "<li class=\"sliderImage sliderimage-{$position} {$center} {$full_width}\">";
    $ret .= suffusion_get_image(array('featured' => true, 'excerpt_position' => $excerpt_position, 'default' => true));
    if ($suf_featured_excerpt_type != 'none') {
        $ret .= "<div class=\"{$excerpt_position}\">";
        $ret .= "<p><ins>";
        $ret .= "<a href=\"" . get_permalink($post->ID) . "\"  class='featured-content-title'>";
        if ($suf_featured_excerpt_type != 'excerpt') {
            $ret .= get_the_title($post->ID);
        }
        $ret .= "</a>";
        $ret .= "</ins></p>";
        if ($suf_featured_excerpt_type != 'title') {
            $ret .= suffusion_excerpt(false, false);
        }
        $ret .= "</div>";
    }
    $ret .= "</li>";
    return $ret;
}
 function widget($args, $instance)
 {
     extract($args);
     $selected_category = $instance["selected_category"];
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
     $icon_type = $instance["icon_type"];
     $cat_icon_url = $instance["cat_icon_url"];
     $post_style = $instance["post_style"];
     $post_thumbnail_size = $instance['post_thumbnail_size'];
     $this->post_excerpt_length = $instance['post_excerpt_length'];
     $number_of_posts = $instance["number_of_posts"];
     $icon_height = $instance['icon_height'];
     $icon_width = $instance['icon_width'];
     $all_posts_text = $instance['all_posts_text'];
     $order = isset($instance['order']) ? $instance['order'] : 'DESC';
     $order_by = isset($instance['order_by']) ? $instance['order_by'] : 'date';
     $ignore_sticky = isset($instance['ignore_sticky']) ? $instance['ignore_sticky'] : 'ignore';
     $post_ids = isset($instance['post_ids']) ? $instance['post_ids'] : '';
     $tags = isset($instance['tags']) ? $instance['tags'] : '';
     $post_formats = isset($instance['post_formats']) ? $instance['post_formats'] : '';
     $any_post_type = isset($instance['any_post_type']) ? $instance['any_post_type'] : false;
     $separate_widgets = isset($instance['separate_widgets']) ? $instance['separate_widgets'] : false;
     $ret = "";
     if ($icon_type == 'plugin') {
         if (function_exists('get_cat_icon')) {
             $cat_icon = get_cat_icon('echo=false&cat=' . $selected_category);
             if (trim($cat_icon) != '') {
                 $ret .= "\t\t<div class='suf-cat-posts-widget-image' style='height: {$icon_height};'>";
                 $ret .= $cat_icon;
                 $ret .= "</div>\n";
             }
         }
     } else {
         if ($icon_type == 'custom') {
             if (trim($cat_icon_url) != '') {
                 $ret .= "\t\t<div class='suf-cat-posts-widget-image' style='height: {$icon_height};'>";
                 $ret .= "<a href='" . get_category_link($selected_category) . "'>";
                 $ret .= "<img src='{$cat_icon_url}' alt='" . esc_attr($title) . "' title='" . esc_attr($title) . "' style='width: {$icon_width}; height: {$icon_height};'/>";
                 $ret .= "</a>\n";
                 $ret .= "</div>\n";
             }
         }
     }
     $query_args = array('posts_per_page' => $number_of_posts, 'order' => $order, 'orderby' => $order_by);
     $tax_query = array('relation' => 'AND');
     if ($selected_category != '0' && $selected_category != 0) {
         $query_args['cat'] = $selected_category;
         $cat_tax = array('taxonomy' => 'category', 'field' => 'id', 'terms' => array($selected_category), 'operator' => 'IN');
     }
     $post_in = array();
     if (trim($post_ids) != '') {
         $solo_posts = preg_replace('/\\s\\s+/', ' ', $post_ids);
         $solo_posts = explode(',', $solo_posts);
         if (count($solo_posts) > 0) {
             $post_in = $solo_posts;
         }
     }
     if ($ignore_sticky == 'ignore') {
         $query_args['ignore_sticky_posts'] = true;
     } else {
         if ($ignore_sticky == 'only-sticky') {
             $post_in = get_option('sticky_posts');
         } else {
             $query_args['ignore_sticky_posts'] = false;
         }
     }
     if (is_array($post_in) && count($post_in) > 0) {
         $query_args['post__in'] = $post_in;
     }
     if (trim($tags) != '') {
         $solo_tags = preg_replace('/\\s\\s+/', ' ', $tags);
         if (count($solo_tags) > 0) {
             $query_args['tag'] = $solo_tags;
         }
     }
     if ($post_formats != '') {
         $format_tax = array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array("post-format-{$post_formats}"), 'operator' => 'IN');
     }
     if (isset($cat_tax) && isset($format_tax)) {
         $tax_query[] = $cat_tax;
         $tax_query[] = $format_tax;
         unset($query_args['cat']);
         $query_args['tax_query'] = $tax_query;
     } else {
         if (isset($cat_tax) || isset($format_tax)) {
             unset($query_args['cat']);
             $tax_query = array(isset($cat_tax) ? $cat_tax : $format_tax);
             $query_args['tax_query'] = $tax_query;
         }
     }
     if ($any_post_type) {
         $query_args['post_type'] = 'any';
     }
     $query = new WP_query($query_args);
     if (isset($query->posts) && is_array($query->posts) && count($query->posts) > 0 && !($separate_widgets && ($post_style == 'thumbnail-full' || $post_style == 'thumbnail-excerpt'))) {
         if ($post_style == 'magazine') {
             $ret .= "<ul class='suf-cat-posts-list'>\n";
         } else {
             if ($post_style == 'thumbnail' || $post_style == 'thumbnail-excerpt' || $post_style == 'thumbnail-full') {
                 $ret .= "<ul class='suf-posts-thumbnail'>\n";
             } else {
                 $ret .= "<ul>\n";
             }
         }
         while ($query->have_posts()) {
             $query->the_post();
             if ($post_style == 'magazine') {
                 $ret .= "<li class='suf-cat-post'><a href='" . get_permalink() . "' class='suf-cat-post'>" . get_the_title() . "</a></li>\n";
             } else {
                 if ($post_style == 'thumbnail') {
                     $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                     $ret .= "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a></li>\n";
                 } else {
                     if ($post_style == 'thumbnail-excerpt') {
                         add_filter('excerpt_length', array(&$this, 'excerpt_length'));
                         $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                         $ret .= "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a>" . suffusion_excerpt(false, false, false) . "</li>\n";
                     } else {
                         if ($post_style == 'thumbnail-full') {
                             $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                             $continue = __('Continue reading &raquo;', 'suffusion');
                             $content = get_the_content($continue);
                             $content = apply_filters('the_content', $content);
                             $content = str_replace(']]>', ']]&gt;', $content);
                             $ret .= "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a>" . $content . "</li>\n";
                         } else {
                             if ($post_style == 'thumbnail-only') {
                                 $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size, 'no-link' => true));
                                 $ret .= "<li class='suf-widget-mosaic'><div class='suf-widget-thumb'><a href='" . get_permalink() . "' title=\"" . esc_attr(get_the_title()) . "\">" . $image . "</a></div></li>\n";
                             } else {
                                 $ret .= "<li><a href='" . get_permalink() . "'>" . get_the_title() . "</a></li>\n";
                             }
                         }
                     }
                 }
             }
         }
         wp_reset_query();
         $ret .= "</ul>";
     } else {
         if ($separate_widgets && ($post_style == 'thumbnail-full' || $post_style == 'thumbnail-excerpt')) {
             $original_before_widget = $before_widget;
             while ($query->have_posts()) {
                 $query->the_post();
                 $before_widget = preg_replace('/(?<=id=")[^"]+/', '$0-' . get_the_ID(), $original_before_widget);
                 echo $before_widget . "\n";
                 echo $before_title . get_the_title() . $after_title;
                 if ($post_style == 'thumbnail-full') {
                     $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                     $continue = __('Continue reading &raquo;', 'suffusion');
                     $content = get_the_content($continue);
                     $content = apply_filters('the_content', $content);
                     $content = str_replace(']]>', ']]&gt;', $content);
                     echo "<div class='suf-widget-thumb'>" . $image . "</div>" . $content . "\n";
                 } else {
                     add_filter('excerpt_length', array(&$this, 'excerpt_length'));
                     $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                     echo "<div class='suf-widget-thumb'>" . $image . "</div>" . suffusion_excerpt(false, false, false) . "\n";
                 }
                 echo $after_widget . "\n";
             }
             wp_reset_query();
             return;
         }
     }
     if (trim($all_posts_text)) {
         $ret .= "\t<div class='suf-mag-category-footer'>\n";
         $ret .= "\t\t<a href='" . get_category_link($selected_category) . "' class='suf-mag-category-all-posts'>{$all_posts_text}</a>";
         $ret .= "\t</div>\n";
     }
     echo $before_widget;
     if ($title != '') {
         $title = do_shortcode($title);
         echo $before_title . $title . $after_title;
     }
     echo $ret;
     echo $after_widget;
 }
Beispiel #3
0
     $col_class = 'suf-gallery-' . $cpt_posts_per_row . 'c';
 } else {
     if (isset($suf_mosaic_constrain_row) && isset($suf_mosaic_constrain_by_count) && $suf_mosaic_constrain_row == 'count') {
         $col_class = 'suf-gallery-' . $suf_mosaic_constrain_by_count . 'c';
     }
 }
 $ret = "";
 echo "<div class='suf-mosaic fix'>";
 echo "<div class='suf-mosaic-thumbs fix'>";
 while (have_posts()) {
     the_post();
     if (in_array($post->ID, $suffusion_duplicate_posts)) {
         continue;
     }
     $ret .= "\t<div class='suf-mosaic-thumb-container {$col_class}'>\n";
     $image_link = suffusion_get_image(array('mosaic-thumb' => true, 'show-title' => true, 'no-link' => true, 'get-original' => true));
     if (!$image_link) {
         $ret .= "<a href='" . get_permalink() . "'>" . get_the_title() . "</a>";
     } else {
         global $suffusion_original_image, $suf_mosaic_zoom, $suf_mosaic_show_title;
         if (isset($suffusion_original_image) && is_array($suffusion_original_image) && count($suffusion_original_image) > 0) {
             $overlay_html = "<div class='mosaic-overlay'>";
             if ($suf_mosaic_zoom == 'zoom') {
                 $overlay_html .= "<a class='suf-mosaic-thumb' href='" . $suffusion_original_image[0] . "' title='" . esc_attr(get_the_title()) . "' rel='mosaic-lightbox'><span>&nbsp;</span></a>";
             }
             if ($suf_mosaic_show_title == 'hide') {
                 $overlay_html .= "<a class='suf-mosaic-post' href='" . get_permalink() . "' title='" . esc_attr(get_the_title()) . "'><span>&nbsp;</span></a>";
             }
             if ($overlay_html == "<div class='mosaic-overlay'>") {
                 $ret .= "<a class='suf-mosaic-post' href='" . get_permalink() . "' title='" . esc_attr(get_the_title()) . "'>{$image_link}</a>";
                 $ret .= "<a class='suf-mosaic-post-title' href='" . get_permalink() . "'>" . get_the_title() . "</a>";
Beispiel #4
0
 /**
  * Generates an excerpt with additional parameters
  *
  * @param bool $show_image 			Shows a thumbnail if set to true
  * @param bool $echo 				Echoes the output
  * @param bool $filter_length		Whether a filter should be applied to restrict the length of the excerpt
  * @param string $length_callback	Function to call for controlling the excerpt length. Default is <code>suffusion_excerpt_length</code>
  * @return mixed|string|void
  */
 function suffusion_excerpt($show_image = false, $echo = true, $filter_length = true, $length_callback = 'suffusion_excerpt_length')
 {
     $ret = "";
     if ($show_image) {
         $ret = suffusion_get_image(array());
     }
     if ($filter_length) {
         if (function_exists($length_callback)) {
             add_filter('excerpt_length', $length_callback);
         } else {
             add_filter('excerpt_length', 'suffusion_excerpt_length');
         }
     }
     // If this is a YAPB post, disable this filter, otherwise the YAPB thumbnail is shown in excerpts...
     if (function_exists('yapb_is_photoblog_post') && yapb_is_photoblog_post()) {
         global $yapb;
         remove_filter('the_content', array(&$yapb, '_filter_the_content'));
     }
     $excerpt = get_the_excerpt();
     $excerpt = apply_filters('the_excerpt', $excerpt);
     $ret .= $excerpt;
     if ($echo) {
         echo $ret;
     }
     // If this is a YAPB post, re-add this filter for full content posts
     if (function_exists('yapb_is_photoblog_post') && yapb_is_photoblog_post()) {
         global $yapb;
         add_filter('the_content', array(&$yapb, '_filter_the_content'));
     }
     return $ret;
 }
Beispiel #5
0
 the_post();
 if (in_array($post->ID, $suffusion_duplicate_posts)) {
     continue;
 }
 $suffusion_current_post_index++;
 if ($ctr % $number_of_cols == 0) {
     if ($total - 1 - $ctr < $number_of_cols) {
         $cols_per_row = $total - $ctr;
     }
     echo "<div class='suf-tile-row suf-tile-row-{$cols_per_row}-cols fix'>\n";
 }
 global $suf_mag_excerpt_full_story_position;
 do_action('suffusion_before_post', $post->ID, 'tile', $suffusion_current_post_index);
 echo "\t<article class='suf-tile suf-tile-{$cols_per_row}c {$suf_mag_excerpt_full_story_position} suf-tile-ctr-{$ctr}'>\n";
 $image_size = $suf_tile_image_settings == 'inherit' ? 'mag-excerpt' : 'tile-thumb';
 $image_link = suffusion_get_image(array($image_size => true));
 $show_image = isset($show_image) ? $show_image : $suf_tile_images_enabled == 'show' || $suf_tile_images_enabled == 'hide-empty' && $image_link != '';
 if ($show_image) {
     echo "\t\t<div class='suf-tile-image'>" . $image_link . "</div>\n";
 }
 echo "\t\t<h2 class='suf-tile-title'><a class='entry-title' rel='bookmark' href='" . get_permalink($post->ID) . "'>" . get_the_title($post->ID) . "</a></h2>\n";
 get_template_part('custom/byline', 'tile');
 echo "\t\t<div class='suf-tile-text entry-content'>\n";
 suffusion_excerpt();
 echo "\t\t</div>\n";
 if (trim($suf_mag_excerpt_full_story_text)) {
     echo "\t<div class='suf-mag-excerpt-footer'>\n";
     echo "\t\t<a href='" . get_permalink($post->ID) . "' class='suf-mag-excerpt-full-story'>{$suf_mag_excerpt_full_story_text}</a>";
     echo "\t</div>\n";
 }
 echo "\t</article>\n";
 function widget_display_single_featured_post($featured_excerpt_position, $position, $text_display, $text_width, $text_bg_color, $text_color, $link_color, $featured_height, $custom_image_size, $custom_img_height, $custom_img_width, $center_slides, $full_width)
 {
     global $post;
     if ($center_slides == 'on') {
         $center = 'center';
     } else {
         $center = '';
     }
     if ($full_width == 'on') {
         $full_width = 'full-width';
     } else {
         $full_width = '';
     }
     $ret = "<li class=\"sliderImage sliderimage-{$position} {$center} {$full_width}\" style='height: {$featured_height}; '>";
     $ret .= suffusion_get_image(array('featured-widget' => true, 'excerpt_position' => $position, 'default' => true, 'featured-image-custom-size' => $custom_image_size, 'featured-height' => $custom_img_height, 'featured-width' => $custom_img_width));
     if ($text_display != 'none') {
         $style = " background: #{$text_bg_color}; color: #{$text_color}; ";
         if ($position == 'left' || $position == 'right') {
             $style .= " width: {$text_width}; ";
         }
         $style = " style='" . $style . "' ";
         $ret .= "<div class=\"{$position}\" {$style}>";
         $ret .= "<p><ins>";
         $ret .= "<a href=\"" . get_permalink($post->ID) . "\" class='featured-content-title' style='color: #{$link_color};'>";
         if ($text_display != 'excerpt') {
             $ret .= get_the_title($post->ID);
         }
         $ret .= "</a>";
         $ret .= "</ins></p>";
         if ($text_display != 'title') {
             add_filter('excerpt_length', array(&$this, 'excerpt_length'));
             $excerpt = get_the_excerpt();
             $excerpt = apply_filters('the_excerpt', $excerpt);
             $ret .= $excerpt;
         }
         $ret .= "</div>";
     }
     $ret .= "</li>";
     return $ret;
 }
Beispiel #7
0
             $li_class = " class='suf-mag-catblock-post' ";
         } else {
             if ($suf_mag_catblocks_post_style == 'thumbnail' || $suf_mag_catblocks_post_style == 'thumbnail-excerpt') {
                 $ul_class = " class='suf-posts-thumbnail' ";
                 $li_class = " class='fix' ";
             }
         }
         echo "<ul {$ul_class}>\n";
         while ($query->have_posts()) {
             $query->the_post();
             if ($suf_mag_catblocks_post_style == 'thumbnail') {
                 $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $suf_mag_catblocks_thumbnail_size));
                 echo "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a></li>\n";
             } else {
                 if ($suf_mag_catblocks_post_style == 'thumbnail-excerpt') {
                     $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $suf_mag_catblocks_thumbnail_size));
                     echo "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a>" . suffusion_excerpt(false, false, true, 'suffusion_excerpt_length_cat_block') . "</li>\n";
                 } else {
                     echo "<li {$li_class}><a href='" . get_permalink() . "' class='suf-mag-catblock-post'>" . get_the_title() . "</a></li>\n";
                 }
             }
         }
         echo "</ul>";
         wp_reset_postdata();
     }
 }
 if (trim($suf_mag_catblocks_see_all_text)) {
     echo "\t<div class='suf-mag-category-footer fix'>\n";
     echo "\t\t<a href='" . get_category_link($category->cat_ID) . "' class='suf-mag-category-all-posts'>{$suf_mag_catblocks_see_all_text}</a>";
     echo "\t</div>\n";
 }
 function widget($args, $instance)
 {
     if (!is_page()) {
         return;
     }
     wp_reset_query();
     global $post;
     extract($args);
     $title = $instance["title"];
     $show_if_empty = isset($instance["show_if_empty"]) ? $instance["show_if_empty"] : false;
     $order_by = $instance["order_by"];
     $order = $instance["order"];
     $include = $instance["include"];
     $exclude = $instance["exclude"];
     $parent = isset($instance["parent"]) ? $instance["parent"] : false;
     $number = $instance["number"];
     $post_style = $instance["post_style"];
     $depth = $instance["depth"];
     $post_thumbnail_size = $instance["post_thumbnail_size"];
     $post_excerpt_length = $instance["post_excerpt_length"];
     $this->post_excerpt_length = $post_excerpt_length;
     $page_args = array('order_by' => $order_by, 'order' => $order, 'child_of' => $post->ID, 'parent' => !$parent ? $post->ID : -1, 'depth' => $depth, 'title_li' => '', 'echo' => false);
     if (trim($number) != '' && suffusion_admin_check_integer(trim($number))) {
         $page_args['number'] = $number;
     }
     if (trim($include) != '') {
         $include = preg_replace('/\\s\\s+/', ' ', $include);
         $include = explode(',', $include);
         if (count($include) > 0) {
             $page_args['include'] = $include;
         }
     }
     if (trim($exclude) != '') {
         $exclude = preg_replace('/\\s\\s+/', ' ', $exclude);
         $exclude = explode(',', $exclude);
         if (count($exclude) > 0) {
             $page_args['exclude'] = $exclude;
         }
     }
     if ($post_style == 'list') {
         $pages = wp_list_pages($page_args);
         if (!$show_if_empty && trim($pages) == '') {
             return;
         }
     } else {
         $page_list = get_pages($page_args);
         if (!$show_if_empty && count($page_list) == 0) {
             return;
         }
     }
     echo $before_widget;
     if ($title != '') {
         $title = do_shortcode($title);
         echo $before_title . $title . $after_title;
     }
     if (isset($pages) && trim($pages) != '') {
         echo "<ul>";
         echo $pages;
         echo "</ul>";
     } else {
         if (isset($page_list) && count($page_list) != 0) {
             echo "<ul class='suf-posts-thumbnail'>\n";
             foreach ($page_list as $page) {
                 setup_postdata($page);
                 $post = $page;
                 if ($post_style == 'thumbnail') {
                     $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                     echo "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink($page->ID) . "' class='suf-widget-thumb-title'>" . apply_filters('the_title', $page->post_title, $page->ID) . "</a></li>\n";
                 } else {
                     if ($post_style == 'thumbnail-excerpt') {
                         add_filter('excerpt_length', array(&$this, 'excerpt_length'));
                         $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size));
                         echo "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink($page->ID) . "' class='suf-widget-thumb-title'>" . apply_filters('the_title', $page->post_title, $page->ID) . "</a>" . suffusion_excerpt(false, false, false) . "</li>\n";
                     }
                 }
             }
             echo "</ul>";
         }
     }
     echo $after_widget;
     wp_reset_query();
 }