function sf_get_masonry_post($postID, $thumb_type, $fullwidth, $show_title, $show_excerpt, $show_details, $show_read_more, $content_output, $excerpt_length)
    {
        global $sf_options;
        // Get Post Object
        $post_object = sf_build_post_object($postID, $content_output, $excerpt_length);
        // Link config
        $post_links_match_thumb = false;
        if (isset($sf_options['post_links_match_thumb'])) {
            $post_links_match_thumb = $sf_options['post_links_match_thumb'];
        }
        $post_permalink_config = 'href="' . $post_object['permalink'] . '" class="link-to-post"';
        if ($post_links_match_thumb) {
            $link_config = sf_post_item_link();
            $post_permalink_config = $link_config['config'];
        }
        // Variable setup
        $post_item = "";
        // THUMBNAIL MEDIA TYPE SETUP
        $post_item .= apply_filters('sf_before_masonry_post_thumb', '');
        $item_figure = "";
        if ($thumb_type != "none") {
            $item_figure .= sf_post_thumbnail("masonry", $fullwidth);
        }
        if ($item_figure != "") {
            $post_item .= $item_figure;
        }
        // Start Output
        $post_item .= '<div class="details-wrap">';
        $post_item .= '<a ' . $post_permalink_config . '></a>';
        // Title
        if ($post_object['type'] == "post") {
            if ($post_object['format'] == "standard") {
                $post_item .= '<h6>' . __("Article", "swiftframework") . '</h6>';
            } else {
                $post_item .= '<h6>' . $post_object['format'] . '</h6>';
            }
        } else {
            $post_item .= '<h6>' . $post_object['type'] . '</h6>';
        }
        if ($show_title == "yes" && $post_object['format'] != "quote" && $post_object['format'] != "link") {
            $post_item .= '<h2 itemprop="name headline">' . $post_object['title'] . '</h2>';
        } else {
            if ($post_object['format'] == "quote") {
                $post_item .= '<div class="quote-excerpt" itemprop="name headline">' . $post_object['excerpt'] . '</div>';
            } else {
                if ($post_object['format'] == "link") {
                    $post_item .= '<h3 itemprop="name headline">' . $post_object['title'] . '</h3>';
                }
            }
        }
        // Details
        if ($show_details == "yes") {
            $post_item .= sf_get_post_details($postID);
        }
        // Excerpt
        if ($show_excerpt == "yes" && $post_object['format'] != "quote") {
            $post_item .= '<div class="excerpt" itemprop="description">' . $post_object['excerpt'] . '</div>';
        }
        // Read More
        if ($show_read_more == "yes") {
            if ($post_object['download_button']) {
                if ($post_object['download_shortcode'] != "") {
                    $post_item .= do_shortcode($post_object['download_shortcode']);
                } else {
                    $post_item .= '<a href="' . wp_get_attachment_url($post_object['download_file']) . '" class="download-button read-more-button">' . $post_object['download_text'] . '</a>';
                }
            }
            $post_item .= '<a class="read-more-button" href="' . $post_object['permalink'] . '">' . __("Read more", "swiftframework") . '</a>';
        }
        // Comments / Likes
        if ($show_details == "yes") {
            $post_item .= '<div class="comments-likes">';
            if (comments_open()) {
                $post_item .= '<div class="comments-wrapper"><a href="' . $post_object['permalink'] . '#comment-area">
	                <svg version="1.1" class="comments-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	                	 width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
	                <path fill="none" class="stroke" stroke="#252525" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
	                	M13.958,24H2.021C1.458,24,1,23.541,1,22.975V2.025C1,1.459,1.458,1,2.021,1h25.957C28.542,1,29,1.459,29,2.025v20.949
	                	C29,23.541,28.542,24,27.979,24H21v5L13.958,24z"/>
	                </svg>
	                <span>' . $post_object['comments'] . '</span></a></div>';
            }
            if (function_exists('lip_love_it_link')) {
                $post_item .= lip_love_it_link($postID, false);
            }
            $post_item .= '</div>';
        }
        // Close Output
        $post_item .= '</div>';
        // Return
        return $post_item;
    }
示例#2
0
    function sf_get_standard_post($postID, $thumb_type, $fullwidth, $show_title, $show_excerpt, $show_details, $show_read_more, $content_output, $excerpt_length)
    {
        global $sf_options;
        $single_author = $sf_options['single_author'];
        $remove_dates = $sf_options['remove_dates'];
        // Get Post Object
        $post_object = sf_build_post_object($postID, $content_output, $excerpt_length);
        // Link config
        $post_links_match_thumb = false;
        if (isset($sf_options['post_links_match_thumb'])) {
            $post_links_match_thumb = $sf_options['post_links_match_thumb'];
        }
        $post_permalink_config = 'href="' . $post_object['permalink'] . '" class="link-to-post"';
        if ($post_links_match_thumb) {
            $link_config = sf_post_item_link();
            $post_permalink_config = $link_config['config'];
        }
        // Variable setup
        $post_item = "";
        $comments_icon = apply_filters('sf_comments_icon', '<i class="ss-chat"></i>');
        $link_icon = apply_filters('sf_link_icon', '<i class="ss-link"></i>');
        $sticky_icon = apply_filters('sf_sticky_icon', '<i class="ss-bookmark"></i>');
        // THUMBNAIL MEDIA TYPE SETUP
        $item_figure = "";
        if ($thumb_type != "none") {
            $item_figure .= sf_post_thumbnail("timeline", $fullwidth);
        }
        // DETAILS SETUP
        $item_details = "";
        if ($single_author && !$remove_dates) {
            $item_details .= '<div class="blog-item-details">' . sprintf(__('In %1$s on <time datetime="%2$s">%3$s</time>', 'swiftframework'), $post_object['categories'], $post_object['date_str'], $post_object['date']) . '</div>';
        } else {
            if (!$remove_dates) {
                $item_details .= '<div class="blog-item-details">' . sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s on <time datetime="%4$s">%5$s</time>', 'swiftframework'), $post_object['author'], get_author_posts_url(get_the_author_meta('ID')), $post_object['categories'], $post_object['date_str'], $post_object['date']) . '</div>';
            } else {
                if (!$single_author) {
                    $item_details .= '<div class="blog-item-details">' . sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s', 'swiftframework'), $post_object['author'], get_author_posts_url(get_the_author_meta('ID')), $post_object['categories']) . '</div>';
                }
            }
        }
        // Open output
        if (sf_theme_opts_name() == "sf_atelier_options" && $show_details == "yes") {
            $post_item .= '<div class="side-details">';
            if (!$remove_dates) {
                $post_date_month = get_the_date('M');
                $post_date_day = get_the_date('d');
                $post_date_year = get_the_date('Y');
                $post_item .= '<div class="side-post-date narrow-date-block" itemprop="datePublished"><span class="month">' . $post_date_month . '</span><span class="day">' . $post_date_day . '</span><span class="year">' . $post_date_year . '</span></div>';
            }
            if (comments_open()) {
                $post_item .= '<div class="comments-wrapper narrow-date-block"><a href="' . $post_object['permalink'] . '#comment-area">
	    		    <svg version="1.1" class="comments-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	    		    	 width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
	    		    <path fill="none" class="stroke" stroke="#252525" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
	    		    	M13.958,24H2.021C1.458,24,1,23.541,1,22.975V2.025C1,1.459,1.458,1,2.021,1h25.957C28.542,1,29,1.459,29,2.025v20.949
	    		    	C29,23.541,28.542,24,27.979,24H21v5L13.958,24z"/>
	    		    </svg>
	    		    <span>' . $post_object['comments'] . '</span></a></div>';
            }
            if (function_exists('lip_love_it_link')) {
                $post_item .= lip_love_it_link(get_the_ID(), false, '', 'narrow-date-block');
            }
            $post_item .= '</div>';
            $post_item .= '<div class="post-content-wrap">';
        }
        $post_item .= $item_figure;
        if ($item_figure == "") {
            $post_item .= '<div class="standard-post-content no-thumb clearfix">';
            // open standard-post-content
        } else {
            $post_item .= '<div class="standard-post-content clearfix">';
            // open standard-post-content
        }
        if ($show_title == "yes" && $post_object['format'] != "link" && $post_object['format'] != "quote") {
            $post_item .= '<h1 itemprop="name headline"><a ' . $post_permalink_config . '>' . $post_object['title'] . '</a></h1>';
        }
        if ($show_details == "yes" && $post_object['format'] != "quote" && $post_object['format'] != "link") {
            if (sf_theme_opts_name() == "sf_atelier_options") {
                if (!$single_author) {
                    $post_item .= '<div class="blog-item-details">' . sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s', 'swiftframework'), $post_object['author'], get_author_posts_url(get_the_author_meta('ID')), $post_object['categories']) . '</div>';
                }
            } else {
                $post_item .= $item_details;
            }
        }
        if ($show_excerpt == "yes") {
            $post_item .= '<div class="excerpt" itemprop="description">' . $post_object['excerpt'] . '</div>';
        } else {
            if ($post_object['format'] == "quote") {
                $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">' . $post_object['excerpt'] . '</div>';
            } else {
                if ($post_object['format'] == "link") {
                    $post_item .= '<div class="link-excerpt heading-font" itemprop="description">' . $link_icon . $post_object['excerpt'] . '</div>';
                }
            }
        }
        if (is_sticky()) {
            $post_item .= '<div class="sticky-post-icon">' . $sticky_icon . '</div>';
        }
        if ($post_object['download_button']) {
            if ($post_object['download_shortcode'] != "") {
                $post_item .= do_shortcode($post_object['download_shortcode']);
            } else {
                $post_item .= '<a href="' . wp_get_attachment_url($post_object['download_file']) . '" class="download-button read-more-button">' . $post_object['download_text'] . '</a>';
            }
        }
        if ($show_read_more == "yes" && $post_object['format'] != "quote" && $post_object['format'] != "link") {
            $post_item .= '<a class="read-more-button" href="' . $post_object['permalink'] . '">' . __("Read more", "swiftframework") . '</a>';
        }
        if ($show_details == "yes") {
            $post_item .= '<div class="comments-likes">';
            if ($post_object['format'] == "quote" || $post_object['format'] == "link") {
                $post_item .= $item_details;
            }
            if (comments_open()) {
                $post_item .= '<div class="comments-wrapper"><a href="' . $post_object['permalink'] . '#comment-area">' . $comments_icon . '<span>' . $post_object['comments'] . '</span></a></div>';
            }
            if (function_exists('lip_love_it_link')) {
                $post_item .= lip_love_it_link(get_the_ID(), false);
            }
            $post_item .= '</div>';
        }
        $post_item .= '</div>';
        // close standard-post-content
        if (sf_theme_opts_name() == "sf_atelier_options" && $show_details == "yes") {
            $post_item .= '</div>';
            // close post-content-wrap
        }
        // Return
        return $post_item;
    }