$post_comments = get_comments_number(); $post_permalink = get_permalink(); $custom_excerpt = sf_get_post_meta($post_id, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($content_output == "excerpt") { if ($custom_excerpt != '') { $post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length); } else { if ($post_format == "quote") { $post_excerpt = sf_get_the_content_with_formatting(); } else { $post_excerpt = sf_excerpt($excerpt_length); } } } else { $post_excerpt = sf_get_the_content_with_formatting(); } if ($post_format == "chat") { $post_excerpt = sf_content(40); } else { if ($post_format == "audio") { $post_excerpt = do_shortcode(get_the_content()); } else { if ($post_format == "video") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } else { if ($post_format == "link") { $content = get_the_content(); $content = apply_filters('the_content', $content);
function sf_get_post_item($postID, $blog_type, $show_title = "yes", $show_excerpt = "yes", $show_details = "yes", $excerpt_length = "20", $content_output = "excerpt", $show_read_more = "no") { $post_item = $thumb_img_url = $image_id = ""; $options = get_option('sf_dante_options'); $single_author = $options['single_author']; $remove_dates = false; if (isset($options['remove_dates']) && $options['remove_dates'] == 1) { $remove_dates = true; } global $post, $sf_sidebar_config; $post_format = get_post_format($postID); if ($post_format == "") { $post_format = 'standard'; } $post_title = get_the_title(); $post_author = get_the_author_link(); $post_date = get_the_date(); $post_categories = get_the_category_list(', '); $post_comments = get_comments_number(); $post_permalink = get_permalink(); $custom_excerpt = sf_get_post_meta($postID, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($content_output == "excerpt") { if ($custom_excerpt != '') { $post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length); } else { if ($post_format == "quote") { $post_excerpt = sf_get_the_content_with_formatting(); } else { $post_excerpt = sf_excerpt($excerpt_length); } } } else { $post_excerpt = sf_get_the_content_with_formatting(); } if ($post_format == "chat") { $post_excerpt = sf_content(40); } else { if ($post_format == "audio") { $post_excerpt = do_shortcode(get_the_content()); } else { if ($post_format == "video") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } else { if ($post_format == "link") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } } } } $post_item = $thumb_image = $thumb_width = $thumb_height = $bordered_thumb_width = $bordered_thumb_height = $video = $video_height = $bordered_video_height = $item_class = $link_config = $item_icon = $gallery_size = ''; if ($blog_type == "mini") { if ($sf_sidebar_config == "no-sidebars") { $thumb_width = 446; $thumb_height = NULL; $video_height = 335; } else { $thumb_width = 370; $thumb_height = NULL; $video_height = 260; } $gallery_size = 'thumb-image'; } else { if ($blog_type == "masonry" || $blog_type == "masonry-fw") { if ($sf_sidebar_config == "both-sidebars" || $blog_type == "masonry-fw") { $item_class = "col-sm-3"; } else { $item_class = "col-sm-4"; } $thumb_width = 480; $thumb_height = NULL; $video_height = 360; $gallery_size = 'thumb-image'; } else { $thumb_width = 970; $thumb_height = NULL; $video_height = 728; $gallery_size = 'blog-image'; } } $thumb_type = sf_get_post_meta($postID, 'sf_thumbnail_type', true); $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full'); $thumb_video = sf_get_post_meta($postID, 'sf_thumbnail_video_url', true); $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=' . $gallery_size); $thumb_link_type = sf_get_post_meta($postID, 'sf_thumbnail_link_type', true); $thumb_link_url = sf_get_post_meta($postID, 'sf_thumbnail_link_url', true); $thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large'); $thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large'); $thumb_lightbox_video_url = sf_get_post_meta($postID, 'sf_thumbnail_link_video_url', true); $thumb_lightbox_video_url = sf_get_embed_src($thumb_lightbox_video_url); $image_id = 0; foreach ($thumb_image as $detail_image) { $image_id = $detail_image['ID']; $thumb_img_url = $detail_image['url']; break; } if (!$thumb_image) { $thumb_image = get_post_thumbnail_id($postID); $image_id = $thumb_image; $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); } $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full'); $item_figure = $link_config = ""; // LINK TYPE VARIABLES if ($thumb_link_type == "link_to_url") { $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"'; $item_icon = "ss-link"; } else { if ($thumb_link_type == "link_to_url_nw") { $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"'; $item_icon = "ss-link"; } else { if ($thumb_link_type == "lightbox_thumb") { $link_config = 'href="' . $thumb_img_url . '" class="lightbox" data-rel="ilightbox[' . $post_ID . ']"'; $item_icon = "ss-view"; } else { if ($thumb_link_type == "lightbox_image") { $lightbox_image_url = ''; foreach ($thumb_lightbox_image as $image) { $lightbox_image_url = $image['full_url']; } $link_config = 'href="' . $lightbox_image_url . '" class="lightbox" data-rel="ilightbox[' . $post_ID . ']"'; $item_icon = "ss-view"; } else { if ($thumb_link_type == "lightbox_video") { $link_config = 'data-video="' . $thumb_lightbox_video_url . '" href="#" class="fw-video-link"'; $item_icon = "ss-video"; } else { $link_config = 'href="' . $post_permalink . '" class="link-to-post"'; $item_icon = "ss-navigateright"; } } } } } // THUMBNAIL MEDIA TYPE SETUP if ($thumb_type != "none") { $item_figure .= '<figure class="animated-overlay overlay-alt">'; if ($thumb_type == "video") { $video = sf_video_embed($thumb_video, $thumb_width, $video_height); $item_figure .= $video; } else { if ($thumb_type == "slider") { $item_figure .= '<div class="flexslider thumb-slider"><ul class="slides">'; foreach ($thumb_gallery as $image) { $item_figure .= "<li><a " . $link_config . "><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></a></li>"; } $item_figure .= '</ul></div>'; } else { if ($thumb_img_url == "") { $thumb_image = get_post_thumbnail_id($postID); $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); } $image = sf_aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false); $thumbnail_id = get_post_thumbnail_id($postID); $image_alt = sf_get_post_meta($image_id, '_wp_attachment_image_alt', true); if ($image) { $item_figure .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $image_alt . '" />'; $item_figure .= '<a ' . $link_config . '></a>'; $item_figure .= '<figcaption><div class="thumb-info thumb-info-alt">'; $item_figure .= '<i class="' . $item_icon . '"></i>'; $item_figure .= '</div></figcaption>'; } } } $item_figure .= '</figure>'; } // MASONRY STYLING if ($blog_type == "masonry" || $blog_type == "masonry-fw") { $post_item .= '<div class="masonry-item-wrap">'; if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font entry-title" itemprop="description">' . $post_excerpt . '</div>'; } else { if ($post_format == "link") { $post_item .= '<div class="link-excerpt heading-font entry-title" itemprop="description">' . $post_excerpt . '</div>'; } else { $post_item .= $item_figure; } } $post_item .= '<div class="details-wrap clearfix">'; if ($show_title == "yes" && $post_format != "quote" && $post_format != "link") { if ($single_author && $remove_dates) { $post_item .= '<h4 itemprop="name headline" class="entry-title no-details"><a href="' . $post_permalink . '">' . $post_title . '</a></h4>'; } else { $post_item .= '<h4 itemprop="name headline" class="entry-title"><a href="' . $post_permalink . '">' . $post_title . '</a></h4>'; } } if ($show_details == "yes" && $post_format != "quote" && $post_format != "link") { if ($single_author && !$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf('<span class="date updated">%1$s</span>', $post_date) . '</div>'; } else { if (!$remove_dates) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span> on <span class="date updated">%2$s</span>', 'swiftframework'), $post_author, $post_date) . '</div>'; } else { if (!$single_author) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span>', 'swiftframework'), $post_author) . '</div>'; } } } } // POST EXCERPT if ($show_excerpt == "yes" && $post_excerpt != "0") { if ($post_format != "quote" && $post_format != "link") { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } } // POST DETAILS if (is_sticky()) { $post_item .= '<div class="sticky-post-icon"><i class="ss-bookmark"></i></div>'; } if ($show_read_more == "yes") { $post_item .= '<a class="read-more-button" href="' . $post_permalink . '">' . __("Read more", "swiftframework") . '</a>'; } if ($show_details == "yes") { $post_item .= '<div class="comments-likes">'; if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_permalink . '#comment-area"><i class="ss-chat"></i><span>' . $post_comments . '</span></a></div>'; } if (function_exists('lip_love_it_link')) { $post_item .= lip_love_it_link(get_the_ID(), '<i class="ss-heart"></i>', '<i class="ss-heart"></i>', false); } $post_item .= '</div>'; } $post_item .= '<meta itemprop="datePublished" content="' . get_the_date('Y-m-d') . '"/>'; $post_item .= '</div>'; $post_item .= '</div>'; // MINI STYLING } else { if ($blog_type == "mini") { $post_item .= '<div class="mini-blog-item-wrap">'; if ($post_format == "quote" || $post_format == "link") { $post_item .= '<div class="mini-alt-wrap">'; } else { $post_item .= $item_figure; } $post_item .= '<div class="blog-details-wrap">'; if ($show_title == "yes" && $post_format != "quote" && $post_format != "link") { $post_item .= '<h3 itemprop="name headline" class="entry-title"><a href="' . $post_permalink . '">' . $post_title . '</a></h3>'; } if ($show_details == "yes" && $post_format != "quote" && $post_format != "link") { if ($single_author && !$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf('<span class="date updated">%1$s</span>', $post_date) . '</div>'; } else { if (!$remove_dates) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span> on <span class="date updated">%2$s</span>', 'swiftframework'), $post_author, $post_date) . '</div>'; } else { if (!$single_author) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span>', 'swiftframework'), $post_author) . '</div>'; } } } } if ($show_excerpt == "yes") { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">' . $post_excerpt . '</div>'; } else { if ($post_format == "link") { $post_item .= '<div class="link-excerpt heading-font" itemprop="description"><i class="ss-link"></i>' . $post_excerpt . '</div>'; } else { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } } } if (is_sticky()) { $post_item .= '<div class="sticky-post-icon"><i class="ss-bookmark"></i></div>'; } if ($show_read_more == "yes") { $post_item .= '<a class="read-more-button" href="' . $post_permalink . '">' . __("Read more", "swiftframework") . '</a>'; } if ($show_details == "yes") { $post_item .= '<div class="comments-likes">'; if ($post_format == "quote" || $post_format == "link") { if ($single_author && !$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf('<span class="date updated">%1$s</span>', $post_date) . '</div>'; } else { if (!$remove_dates) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span> on <span class="date updated">%2$s</span>', 'swiftframework'), $post_author, $post_date) . '</div>'; } else { if (!$single_author) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span>', 'swiftframework'), $post_author) . '</div>'; } } } } if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_permalink . '#comment-area"><i class="ss-chat"></i><span>' . $post_comments . '</span></a></div>'; } if (function_exists('lip_love_it_link')) { $post_item .= lip_love_it_link(get_the_ID(), '<i class="ss-heart"></i>', '<i class="ss-heart"></i>', false); } $post_item .= '</div>'; } $post_item .= '<meta itemprop="datePublished" content="' . get_the_date('Y-m-d') . '"/>'; $post_item .= '</div>'; if ($post_format == "quote" || $post_format == "link") { $post_item .= '</div>'; } $post_item .= '</div>'; // STANDARD STYLING } else { if ($show_details == "yes") { $post_item .= '<span class="standard-post-date" itemprop="datePublished">' . $post_date . '</span>'; } $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 && $post_format != "link" && $post_format != "quote") { $post_item .= '<h1 itemprop="name headline" class="entry-title"><a href="' . $post_permalink . '">' . $post_title . '</a></h1>'; } if ($show_details == "yes" && $post_format != "quote" && $post_format != "link") { if ($single_author && !$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf('<span class="date updated">%1$s</span>', $post_date) . '</div>'; } else { if (!$remove_dates) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span> on <span class="date updated">%2$s</span>', 'swiftframework'), $post_author, $post_date) . '</div>'; } else { if (!$single_author) { $post_item .= '<div class="blog-item-details vcard author">' . sprintf(__('By <span itemprop="author" class="fn">%1$s</span>', 'swiftframework'), $post_author) . '</div>'; } } } } if ($show_excerpt == "yes") { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">' . $post_excerpt . '</div>'; } else { if ($post_format == "link") { $post_item .= '<div class="link-excerpt heading-font" itemprop="description"><i class="ss-link"></i>' . $post_excerpt . '</div>'; } else { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } } } if (is_sticky()) { $post_item .= '<div class="sticky-post-icon"><i class="ss-bookmark"></i></div>'; } if ($show_read_more == "yes") { $post_item .= '<a class="read-more-button" href="' . $post_permalink . '">' . __("Read more", "swiftframework") . '</a>'; } if ($show_details == "yes") { $post_item .= '<div class="comments-likes">'; if ($post_format == "quote" || $post_format == "link") { if ($single_author && !$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf(__('%1$s', 'swiftframework'), $post_date) . '</div>'; } else { if (!$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf(__('By <a href="%2$s" rel="author" itemprop="author">%1$s</a> on %3$s', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_date) . '</div>'; } else { if (!$single_author) { $post_item .= '<div class="blog-item-details">' . sprintf(__('By <a href="%2$s" rel="author" itemprop="author">%1$s</a>', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta('ID'))) . '</div>'; } } } } if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_permalink . '#comment-area"><i class="ss-chat"></i><span>' . $post_comments . '</span></a></div>'; } if (function_exists('lip_love_it_link')) { $post_item .= lip_love_it_link(get_the_ID(), '<i class="ss-heart"></i>', '<i class="ss-heart"></i>', false); } $post_item .= '</div>'; } $post_item .= '<meta itemprop="datePublished" content="' . get_the_date('Y-m-d') . '"/>'; $post_item .= '</div>'; // close standard-post-content } } return $post_item; }
function sf_get_post_item($postID, $blog_type, $show_title = "yes", $show_excerpt = "yes", $show_details = "yes", $excerpt_length = "20", $content_output = "excerpt", $show_read_more = "yes", $fullwidth = "no") { $post_item = $image_id = ""; global $sf_options, $sf_sidebar_config; $single_author = $sf_options['single_author']; $remove_dates = $sf_options['remove_dates']; $post_links_match_thumb = false; if (isset($sf_options['post_links_match_thumb'])) { $post_links_match_thumb = $sf_options['post_links_match_thumb']; } $post_format = get_post_format($postID); if ($post_format == "") { $post_format = 'standard'; } if ($blog_type == "masonry") { $content_output = "excerpt"; } $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>'); $post_type = get_post_type($postID); $post_title = get_the_title(); $post_author = get_the_author(); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', '); $post_comments = get_comments_number(); $post_permalink = get_permalink(); $custom_excerpt = sf_get_post_meta($postID, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($content_output == "excerpt") { if ($custom_excerpt != '') { $post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length); } else { if ($post_format == "quote") { $post_excerpt = sf_get_the_content_with_formatting(); } else { $post_excerpt = sf_excerpt($excerpt_length); } } } else { $post_excerpt = sf_get_the_content_with_formatting(); } if ($post_format == "chat") { $post_excerpt = sf_content(40); } else { if ($post_format == "audio") { $post_excerpt = do_shortcode(get_the_content()); } else { if ($post_format == "video") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } else { if ($post_format == "link") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } } } } $post_permalink_config = 'href="' . $post_permalink . '" class="link-to-post"'; if ($post_links_match_thumb) { $link_config = sf_post_item_link(); $post_permalink_config = $link_config['config']; } $thumb_type = sf_get_post_meta($postID, 'sf_thumbnail_type', true); $download_button = sf_get_post_meta($postID, 'sf_download_button', true); $download_file = sf_get_post_meta($postID, 'sf_download_file', true); $download_text = apply_filters('sf_post_download_text', __("Download", "swiftframework")); $download_shortcode = sf_get_post_meta($postID, 'sf_download_shortcode', true); if ($blog_type == "masonry") { $post_item .= apply_filters('sf_before_masonry_post_thumb', ''); } // THUMBNAIL MEDIA TYPE SETUP $item_figure = ""; if ($thumb_type != "none") { $item_figure .= sf_post_thumbnail($blog_type, $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_categories, $post_date_str, $post_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_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories, $post_date_str, $post_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_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories) . '</div>'; } } } $mini_details = ""; if ($single_author && !$remove_dates) { $mini_details .= '<div class="mini-item-details">' . sprintf(__('in %1$s / <time datetime="%2$s">%3$s</time> / %4$s comments', 'swiftframework'), $post_categories, $post_date_str, $post_date, $post_comments) . '</div>'; } else { if (!$remove_dates) { $mini_details .= '<div class="mini-item-details">' . sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s / <time datetime="%4$s">%5$s</time> / %6$s comments', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories, $post_date_str, $post_date, $post_comments) . '</div>'; } else { if (!$single_author) { $mini_details .= '<div class="mini-item-details">' . sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> / %3$s / %4$s comments', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories, $post_comments) . '</div>'; } } } // BOLD STYLING if ($blog_type == "bold") { $post_item .= '<div class="bold-item-wrap">'; if ($show_title == "yes" && $post_format != "quote" && $post_format != "link") { $post_item .= '<h1 itemprop="name headline"><a ' . $post_permalink_config . '>' . $post_title . '</a></h1>'; } else { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt" itemprop="name headline"><a ' . $post_permalink_config . '>' . $post_excerpt . '</a></div>'; } else { if ($post_format == "link") { $post_item .= '<h3 itemprop="name headline"><a ' . $post_permalink_config . '>' . $post_title . '</a></h3>'; } } } if ($show_excerpt == "yes" && $post_format != "quote") { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } if ($show_details == "yes") { if ($single_author && !$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf(__('<span>In %1$s</span> <time class="date" datetime="%2$s">%3$s</time>', 'swiftframework'), $post_categories, $post_date_str, $post_date) . '</div>'; } else { if (!$remove_dates) { $post_item .= '<div class="blog-item-details">' . sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> <span>in %3$s</span> <time class="date" datetime="%4$s">%5$s</time>', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories, $post_date_str, $post_date) . '</div>'; } else { 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> <span>in %3$s</span>', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories) . '</div>'; } } } } $post_item .= '</div>'; } else { if ($blog_type == "masonry") { if ($item_figure != "") { $post_item .= $item_figure; } $post_item .= '<div class="details-wrap">'; $post_item .= '<a ' . $post_permalink_config . '></a>'; if ($post_type == "post") { if ($post_format == "standard") { $post_item .= '<h6>' . __("Article", "swiftframework") . '</h6>'; } else { $post_item .= '<h6>' . $post_format . '</h6>'; } } else { $post_item .= '<h6>' . $post_type . '</h6>'; } if ($show_title == "yes" && $post_format != "quote" && $post_format != "link") { $post_item .= '<h2 itemprop="name headline">' . $post_title . '</h2>'; } else { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt" itemprop="name headline">' . $post_excerpt . '</div>'; } else { if ($post_format == "link") { $post_item .= '<h3 itemprop="name headline">' . $post_title . '</h3>'; } } } if (sf_theme_opts_name() == "sf_atelier_options") { if ($show_details == "yes") { $post_item .= sf_get_post_details($postID); } if ($show_excerpt == "yes" && $post_format != "quote") { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } if ($show_read_more == "yes") { if ($download_button) { if ($download_shortcode != "") { $post_item .= do_shortcode($download_shortcode); } else { $post_item .= '<a href="' . wp_get_attachment_url($download_file) . '" class="download-button read-more-button">' . $download_text . '</a>'; } } $post_item .= '<a class="read-more-button" href="' . get_permalink() . '">' . __("Read more", "swiftframework") . '</a>'; } if ($show_details == "yes") { $post_item .= '<div class="comments-likes">'; if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_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_comments . '</span></a></div>'; } if (function_exists('lip_love_it_link')) { $post_item .= lip_love_it_link(get_the_ID(), false); } $post_item .= '</div>'; } } else { if ($show_excerpt == "yes" && $post_format != "quote") { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } if ($show_details == "yes") { $post_item .= sf_get_post_details($postID); $post_item .= '<div class="comments-likes">'; if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_permalink . '#comment-area">' . $comments_icon . '<span>' . $post_comments . '</span></a></div>'; } if (function_exists('lip_love_it_link')) { $post_item .= lip_love_it_link($postID, false); } $post_item .= '</div>'; } } $post_item .= '</div>'; // MINI STYLING } else { if ($blog_type == "mini") { $post_item .= '<div class="mini-blog-item-wrap clearfix">'; if ($post_format == "quote" || $post_format == "link") { $post_item .= '<div class="mini-alt-wrap">'; } else { $post_item .= $item_figure; } $post_item .= '<div class="blog-details-wrap clearfix">'; if ($show_title == "yes" && $post_format != "quote" && $post_format != "link") { $post_item .= '<h3 itemprop="name headline"><a ' . $post_permalink_config . '>' . $post_title . '</a></h3>'; } if ($show_details == "yes" && $post_format != "quote" && $post_format != "link") { if (sf_theme_opts_name() == "sf_atelier_options") { $post_item .= $mini_details; } else { $post_item .= $item_details; } } if ($show_excerpt == "yes") { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">' . $post_excerpt . '</div>'; } else { if ($post_format == "link") { $post_item .= '<div class="link-excerpt heading-font" itemprop="description">' . $link_icon . $post_excerpt . '</div>'; } else { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } } } if (is_sticky()) { $post_item .= '<div class="sticky-post-icon">' . $sticky_icon . '</div>'; } if ($show_read_more == "yes") { if ($download_button) { if ($download_shortcode != "") { $post_item .= do_shortcode($download_shortcode); } else { $post_item .= '<a href="' . wp_get_attachment_url($download_file) . '" class="download-button read-more-button">' . $download_text . '</a>'; } } $post_item .= '<a class="read-more-button" href="' . get_permalink() . '">' . __("Read more", "swiftframework") . '</a>'; } if ($show_details == "yes") { $post_item .= '<div class="comments-likes">'; if ($post_format == "quote" || $post_format == "link") { $post_item .= $item_details; } if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_permalink . '#comment-area">' . $comments_icon . '<span>' . $post_comments . '</span></a></div>'; } if (function_exists('lip_love_it_link')) { $post_item .= lip_love_it_link($postID, false); } $post_item .= '</div>'; } $post_item .= '</div>'; if ($post_format == "quote" || $post_format == "link") { $post_item .= '</div>'; } $post_item .= '</div>'; // STANDARD STYLING } else { if (sf_theme_opts_name() == "sf_atelier_options" && $show_details == "yes" && $blog_type != "timeline") { $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_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_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">'; } if ($show_details == "yes" && $blog_type == "timeline") { $post_item .= '<span class="standard-post-date" itemprop="datePublished">' . $post_date . '</span>'; } $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_format != "link" && $post_format != "quote") { $post_item .= '<h1 itemprop="name headline"><a ' . $post_permalink_config . '>' . $post_title . '</a></h1>'; } if ($show_details == "yes" && $post_format != "quote" && $post_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_author, get_author_posts_url(get_the_author_meta('ID')), $post_categories) . '</div>'; } } else { $post_item .= $item_details; } } if ($show_excerpt == "yes") { $post_item .= '<div class="excerpt" itemprop="description">' . $post_excerpt . '</div>'; } else { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">' . $post_excerpt . '</div>'; } else { if ($post_format == "link") { $post_item .= '<div class="link-excerpt heading-font" itemprop="description">' . $link_icon . $post_excerpt . '</div>'; } } } if (is_sticky()) { $post_item .= '<div class="sticky-post-icon">' . $sticky_icon . '</div>'; } if ($download_button) { if ($download_shortcode != "") { $post_item .= do_shortcode($download_shortcode); } else { $post_item .= '<a href="' . wp_get_attachment_url($download_file) . '" class="download-button read-more-button">' . $download_text . '</a>'; } } if ($show_read_more == "yes" && $post_format != "quote" && $post_format != "link") { $post_item .= '<a class="read-more-button" href="' . get_permalink() . '">' . __("Read more", "swiftframework") . '</a>'; } if ($show_details == "yes") { $post_item .= '<div class="comments-likes">'; if ($post_format == "quote" || $post_format == "link") { $post_item .= $item_details; } if (comments_open()) { $post_item .= '<div class="comments-wrapper"><a href="' . $post_permalink . '#comment-area">' . $comments_icon . '<span>' . $post_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" && $blog_type != "timeline") { $post_item .= '</div>'; // close post-content-wrap } // $post_item = sf_get_content_view( 'post', 'standard', true ); // return $post_item; } } } return $post_item; }
function sf_build_post_object($postID, $content_output, $excerpt_length) { // Post Format $post_format = get_post_format($postID); // Excerpt config $custom_excerpt = sf_get_post_meta($postID, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($content_output == "excerpt") { if ($custom_excerpt != '') { $post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length); } else { if ($post_format == "quote") { $post_excerpt = sf_get_the_content_with_formatting(); } else { $post_excerpt = sf_excerpt($excerpt_length); } } } else { $post_excerpt = sf_get_the_content_with_formatting(); } if ($post_format == "chat") { $post_excerpt = sf_content(40); } else { if ($post_format == "audio") { $post_excerpt = do_shortcode(get_the_content()); } else { if ($post_format == "video") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } else { if ($post_format == "link") { $content = get_the_content(); $content = apply_filters('the_content', $content); $post_excerpt = $content; } } } } // Post Object $post_object = array('format' => $post_format, 'type' => get_post_type($postID), 'title' => get_the_title(), 'author' => get_the_author(), 'date' => get_the_date(), 'date_str' => get_the_date('Y-m-d'), 'categories' => $post_categories = get_the_category_list(', '), 'comments' => get_comments_number(), 'permalink' => get_permalink(), 'excerpt' => $post_excerpt, 'thumb_type' => sf_get_post_meta($postID, 'sf_thumbnail_type', true), 'download_button' => sf_get_post_meta($postID, 'sf_download_button', true), 'download_file' => sf_get_post_meta($postID, 'sf_download_file', true), 'download_text' => apply_filters('sf_post_download_text', __("Download", "swiftframework")), 'download_shortcode' => sf_get_post_meta($postID, 'sf_download_shortcode', true)); // Apply filters $post_object = apply_filters('sf_blog_post_object', $post_object); // Return post object return $post_object; }