if ($preview_type != 'none' and !post_password_required()) { $post_thumbnail_id = get_post_thumbnail_id(); if ($preview_type == 'basic') { if ($post_thumbnail_id) { $preview_html = wp_get_attachment_image($post_thumbnail_id, 'large'); } else { // Retreiving preview HTML from the post content $preview_html = us_get_post_preview($the_content, TRUE); } } elseif ($preview_type == 'modern') { if ($post_thumbnail_id) { $image = wp_get_attachment_image_src($post_thumbnail_id, 'full'); $preview_bg = $image[0]; } elseif ($post_format == 'image') { // Retreiving image from post content to use it as preview background $preview_bg_html = us_get_post_preview($the_content, TRUE); if (preg_match('~src=\\"([^\\"]+)\\"~u', $preview_bg_html, $matches)) { $preview_bg = $matches[1]; } } } } $the_content = apply_filters('the_content', $the_content); // The post itself may be paginated via <!--nextpage--> tags $pagination = us_wp_link_pages(array('before' => '<div class="g-pagination"><nav class="navigation pagination" role="navigation">', 'after' => '</nav></div>', 'next_or_number' => 'next_and_number', 'nextpagelink' => '>', 'previouspagelink' => '<', 'link_before' => '<span>', 'link_after' => '</span>', 'echo' => 0)); // If content has no sections, we'll create them manually $has_own_sections = strpos($the_content, ' class="l-section') !== FALSE; if (!$has_own_sections) { $the_content = '<section class="l-section"><div class="l-section-h i-cf">' . $the_content . $pagination . '</div></section>'; } elseif (!empty($pagination)) { $the_content .= '<section class="l-section"><div class="l-section-h i-cf">' . $pagination . '</div></section>';
$post_format = get_post_format() ? get_post_format() : 'standard'; // Determining thumbnail size $thumbnail_sizes = array('large' => 'large', 'smallcircle' => 'tnail-1x1-small', 'smallsquared' => 'tnail-1x1-small', 'compact' => FALSE, 'related' => 'tnail-3x2', 'grid' => 'tnail-3x2', 'masonry' => 'tnail-masonry'); $has_preview = (!isset($thumbnail_sizes[$layout_type]) or $thumbnail_sizes[$layout_type] !== FALSE); $the_content = get_the_content(); $featured_image = ''; $featured_html = ''; if ($has_preview and !post_password_required()) { $thumbnail_size = isset($thumbnail_sizes[$layout_type]) ? $thumbnail_sizes[$layout_type] : 'large'; $featured_image = has_post_thumbnail() ? get_the_post_thumbnail(get_the_ID(), $thumbnail_size) : ''; if ($featured_image == '') { // We fetch previews for images at any layout and for any post formats at large / grid / masonry layouts if ($post_format == 'image') { $featured_image = us_get_post_preview($the_content, TRUE); } elseif (in_array($layout_type, array('large', 'grid', 'masonry'))) { $featured_html = us_get_post_preview($the_content, TRUE); } } } // We need some special markup for quotes $use_special_quote_markup = ($post_format == 'quote' and !in_array($layout_type, array('compact', 'related'))); if ($use_special_quote_markup) { // Always display content for normal quotes $content_type = 'content'; } if ($content_type == 'content') { $the_content = apply_filters('the_content', $the_content); } elseif ($content_type == 'none') { $the_content = ''; } else { $the_content = apply_filters('the_excerpt', get_the_excerpt());