/** * Get a different post thumbnail depending on context * * @param boolean $echo Whether to echo the date. Default true. * @return string */ function wolf_entry_thumbnail($echo = true) { $thumbnail = ''; $format = get_post_format() ? get_post_format() : 'standard'; $no_thumb = array('video', 'gallery', 'link', 'status', 'quote', 'aside', 'link', 'chat'); $is_instagram = 'image' == $format && preg_match(wolf_get_regex('instagram'), get_the_content()); if (has_post_thumbnail()) { if ('work' == get_post_type() && !is_single()) { $thumbnail = get_the_post_thumbnail(get_the_ID(), 'classic-thumb'); } elseif ('image' == $format && is_single()) { $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('big'); $full_img = wolf_get_post_thumbnail_url('full'); $lightbox_class = 'lightbox'; $thumbnail = '<div class="entry-thumbnail">'; $thumbnail .= "<a title='{$caption}' class='{$lightbox_class} zoom' href='{$full_img}'>"; $thumbnail .= "<img src='{$img}' alt='{$img_alt}'>"; $thumbnail .= '</a>'; $thumbnail .= '</div>'; } elseif ('video' == $format && !is_single()) { $thumbnail = get_the_post_thumbnail(get_the_ID(), '1x1'); } elseif (!is_single()) { $thumbnail = get_the_post_thumbnail(get_the_ID(), '2x2'); } } elseif (is_page_template('page-templates/home.php')) { $thumbnail = '<img src="' . wolf_get_theme_uri('/images/empty.gif') . '">'; } if ($echo) { echo wp_kses($thumbnail, array('div' => array('class' => array()), 'img' => array('src' => array(), 'alt' => array(), 'class' => array()), 'a' => array('href' => array(), 'class' => array(), 'rel' => array(), 'title' => array()))); } return $thumbnail; }
/** * Returns the first soundcloud URL * * @access public * @return string */ function wolf_get_first_soundcloud_url() { $has_soundlcloud_url = preg_match(wolf_get_regex('soundcloud'), get_the_content(), $match); $link = $has_soundlcloud_url ? $match[0] : null; return esc_url($link); }
<?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)) {