/**
  * Prints the post title
  *
  * The title will be linked to the post if we're on an archive page
  *
  */
 function wolf_entry_title($echo = true, $wrapped = true, $force = false)
 {
     $title = '';
     $format = get_post_format() ? get_post_format() : 'standard';
     $no_title = array('status', 'aside', 'quote', 'chat');
     if (has_post_format('link') && !is_single()) {
         if ($wrapped) {
             $title .= '<h2 class="entry-title">';
         }
         $title .= '<a target="_blank" href="' . esc_url(wolf_get_first_url()) . '" rel="no-follow">' . get_the_title() . '</a>';
         if ($wrapped) {
             $title .= '</h2>';
         }
     } elseif (is_single()) {
         if ($wrapped) {
             $title .= '<h1 class="entry-title">';
         }
         $title .= get_the_title();
         if ($wrapped) {
             $title .= '</h1>';
         }
     } elseif (!in_array($format, $no_title) || $force) {
         if ($wrapped) {
             $title .= '<h2 class="entry-title">';
         }
         $title .= '<a href="' . esc_url(get_permalink()) . '" class="entry-link" rel="bookmark">' . get_the_title() . '</a></h2>';
         if ($wrapped) {
             $title .= '</h2>';
         }
     }
     if ($echo) {
         echo wp_kses($title, array('h2' => array()));
     }
     return $title;
 }
Пример #2
0
 /**
  * Returns featured media
  *
  * @access public
  * @param bool $embed
  * @return string
  */
 function wolf_post_media($embed = true, $thumb_size = 'large')
 {
     $media = null;
     $post_id = get_the_ID();
     $format = get_post_format() ? get_post_format() : 'standard';
     $content = get_the_content();
     $has_thumbnail = has_post_thumbnail();
     $audio = wolf_featured_audio(false);
     $video = wolf_featured_video(false);
     $gallery = wolf_featured_gallery(false);
     $tweet = wolf_featured_tweet(false);
     $link = wolf_get_first_url();
     $is_standard = 'standard' == $format && $has_thumbnail;
     $is_image = 'image' == $format && $has_thumbnail;
     $is_instagram = 'image' == $format && preg_match(wolf_get_regex('instagram'), $content);
     $is_audio = $audio && 'audio' == $format;
     $is_video = $video && 'video' == $format || 'video' == get_post_type($post_id) ? true : false;
     $is_quote = $format == 'quote';
     $is_gallery = $gallery && 'gallery' == $format;
     $is_link = $format == 'link' && $link;
     $is_tweet = $tweet && ('status' == $format || 'aside' == $format);
     //$is_status =  'status' == $format || 'aside' == $format;
     if ($is_instagram) {
         $media = wolf_featured_instagram($embed);
     } elseif ($is_video) {
         $media = wolf_featured_video($embed);
     } elseif ($is_quote) {
         $media = wolf_featured_quote();
     } elseif ($is_link) {
         if (is_single()) {
             $media = '<h1 class="entry-title"><a href="' . $link . '" target="_blank">' . get_the_title() . '</a></h1>';
         } else {
             $media = '<h2 class="entry-title"><a href="' . $link . '" target="_blank">' . get_the_title() . '</a></h2>';
             $media .= '<p>' . $link . '</p>';
         }
     } elseif ($is_gallery) {
         $media = wolf_featured_gallery($embed, $thumb_size);
     } elseif ($is_audio) {
         if ($embed) {
             if ($has_thumbnail) {
                 $media .= '<div class="entry-thumbnail">';
                 $media .= '<a href="' . get_permalink() . '" title="' . esc_attr(sprintf(__('Permalink to %s', 'wolf'), the_title_attribute('echo=0'))) . '" rel="bookmark">';
                 $media .= get_the_post_thumbnail($post_id, 'large');
                 $media .= '</a>';
                 $media .= '</div>';
             }
             $media .= wolf_featured_audio($embed);
         } else {
             $media = wolf_featured_audio($embed);
         }
     } elseif ($is_image) {
         $img_excerpt = get_post(get_post_thumbnail_id())->post_excerpt;
         $img_alt = esc_attr(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true));
         $caption = $img_excerpt ? $img_excerpt : get_the_title();
         $caption = '';
         $img = wolf_get_post_thumbnail_url('extra-large');
         $full_img = wolf_get_post_thumbnail_url('extra-large');
         $lightbox_class = 'lightbox';
         $media = '<div class="entry-thumbnail">';
         $media .= "<a title='{$caption}' class='{$lightbox_class} zoom' href='{$full_img}'>";
         $media .= "<img src='{$img}' alt='{$img_alt}'>";
         $media .= '</a>';
         $media .= '</div>';
     } elseif ($is_standard) {
         $media = '<div class="entry-thumbnail">';
         if (!is_single()) {
             $media .= '<a class="entry-link" href="' . get_permalink() . '" title="' . esc_attr(sprintf(__('Permalink to %s', 'wolf'), the_title_attribute('echo=0'))) . '" rel="bookmark">';
         }
         $media .= get_the_post_thumbnail($post_id, 'large');
         if (!is_single()) {
             $media .= '</a>';
         }
         $media .= '</div>';
     }
     return $media;
 }
<?php

/**
 * The home page post loop
 */
$post_id = get_the_ID();
$format = get_post_format() ? get_post_format() : 'standard';
$is_instagram = 'image' == $format && preg_match(wolf_get_regex('instagram'), get_the_content());
$thumb_size = wolf_get_image_size('2x2');
$link = wolf_get_first_url();
$quote = 'quote' == $format && wolf_featured_quote();
$permalink = 'link' == $format && $link ? $link : get_permalink();
$no_views = array('status', 'aside', 'link', 'quote');
$views = wolf_format_number(absint(get_post_meta($post_id, '_wolf_views', true)));
$likes = wolf_format_number(absint(get_post_meta($post_id, '_wolf_likes', true)));
$comments = get_comments_number();
?>
<article <?php 
post_class('clearfix');
?>
  id="post-<?php 
the_ID();
?>
" data-post-id="<?php 
the_ID();
?>
">
	<div class="post-square-container">
		<div class="post-square">
			<?php 
if (wolf_featured_tweet(false) && ('status' == $format || 'aside' == $format)) {