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;
 }
Exemple #3
0
function suffusion_excerpt_or_content()
{
    global $suf_category_excerpt, $suf_tag_excerpt, $suf_archive_excerpt, $suf_index_excerpt, $suf_search_excerpt, $suf_author_excerpt, $suf_show_excerpt_thumbnail, $suffusion_current_post_index, $suffusion_full_post_count_for_view, $suf_pop_excerpt, $page_of_posts;
    global $suffusion_cpt_post_id;
    if (isset($suffusion_cpt_post_id)) {
        $cpt_excerpt = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_post_type_layout', true);
        $cpt_image = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_show_excerpt_thumb', true);
    } else {
        $cpt_excerpt = false;
    }
    if ($suffusion_current_post_index > $suffusion_full_post_count_for_view && ($cpt_excerpt || is_category() && $suf_category_excerpt == "excerpt" || is_tag() && $suf_tag_excerpt == "excerpt" || is_search() && $suf_search_excerpt == "excerpt" || is_author() && $suf_author_excerpt == "excerpt" || (is_date() || is_year() || is_month() || is_day() || is_time()) && $suf_archive_excerpt == "excerpt" || isset($page_of_posts) && $page_of_posts && $suf_pop_excerpt == "excerpt" || !(is_singular() || is_category() || is_tag() || is_search() || is_author() || is_date() || is_year() || is_month() || is_day() || is_time()) && $suf_index_excerpt == "excerpt")) {
        $show_image = isset($cpt_image) ? $cpt_image : ($suf_show_excerpt_thumbnail == "show" ? true : false);
        suffusion_excerpt($show_image);
    } else {
        get_template_part('post-formats/content', suffusion_get_post_format());
    }
}
Exemple #4
0
                }
                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";
            do_action('suffusion_after_post', $post->ID, 'tile', $suffusion_current_post_index);
            if ($ctr == $total - 1 || $ctr % $number_of_cols == $number_of_cols - 1) {
                echo "</div>\n";
            }
            $ctr++;
        }
        ?>
</div>
Exemple #5
0
         } 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";
 }
 echo "\t</div>";
 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();
 }