/** * Get the share image * * @param int $post_id * @return string $share_image */ function wolf_get_meta_share_img($post_id) { global $post; /* We define the default image first and see if the post contains an image after */ $share_image = wolf_get_theme_option('share_img') ? wolf_get_url_from_attachment_id(absint(wolf_get_theme_option('share_img')), 'large') : null; if (has_post_thumbnail($post_id)) { $share_image = wolf_get_post_thumbnail_url('large', $post_id); } return $share_image; }
/** * countdown shortcode * * @param array $atts * @return string */ function wolf_shortcode_last_videos_carousel($atts) { if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) { $atts = vc_map_get_attributes('wolf_last_videos_carousel', $atts); } extract(shortcode_atts(array('count' => 3, 'category' => '', 'inline_style' => '', 'class' => ''), $atts)); $count = absint($count); $category = sanitize_text_field($category); $class = sanitize_text_field($class); $inline_style = sanitize_text_field($inline_style); $args = array('post_type' => 'video', 'posts_per_page' => absint($count)); if (wolf_get_theme_option('video_reorder')) { $args['order'] = 'ASC'; $args['meta_key'] = '_position'; $args['orderby'] = 'meta_value_num'; } if ($category) { $args['video_type'] = $category; } $loop = new WP_Query($args); $style = ''; $class = $class ? "{$class} " : ''; // add space $class .= "videos-carousel"; if ($inline_style) { $style .= $inline_style; } $style = $style ? " style='{$style}'" : ''; $output = "<section class='{$class}'{$style}>"; if ($loop->have_posts()) { while ($loop->have_posts()) { $loop->the_post(); $video_url = wolf_get_first_video_url(); $thumbnail = wolf_get_post_thumbnail_url('classic-video-thumb'); if ($video_url) { $output .= "<div class='item-video' data-merge='2' style='background-image:url({$thumbnail});'><a class='owl-video' href='{$video_url}'></a></div>"; } } } $output .= '</section>'; wp_reset_postdata(); return $output; }
/** * 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 /** * This is the main post loop used for the masonry blog * We display each post differently depending on the post format */ $format = get_post_format() ? get_post_format() : 'standard'; $media = wolf_post_media(); $bg = wolf_get_post_thumbnail_url('large'); ?> <article <?php post_class('clearfix post-item-container'); ?> id="post-<?php the_ID(); ?> " data-post-id="<?php the_ID(); ?> " data-bg="<?php echo esc_url($bg); ?> "> <div class="entry-frame entry-content"> <div class="entry-container"> <header class="entry-header"> <?php if ('gallery' == $format && !wolf_is_blog()) { ?> <?php echo wolf_post_gallery_slider('classic-thumb');
exit; } // Exit if accessed directly $term_list = ''; $post_id = get_the_ID(); $post_type = get_post_type(); if (get_the_terms($post_id, $post_type . '_type')) { foreach (get_the_terms($post_id, $post_type . '_type') as $term) { $term_list .= $term->slug . ' '; } } $term_list = $term_list ? substr($term_list, 0, -1) : ''; $format = get_post_format() ? get_post_format() : 'standard'; $views = wolf_format_number(intval(get_post_meta($post_id, '_wolf_views', true))); $likes = wolf_format_number(intval(get_post_meta($post_id, '_wolf_likes', true))); $image = wolf_get_post_thumbnail_url('extra-large'); $bg = esc_url(wolf_get_url_from_attachment_id(get_post_thumbnail_id($post_id), 'extra-large')); $comments = get_comments_number(); $print_term_list = get_the_term_list($post_id, $post_type . '_type', __('in ', 'wolf'), ', ', ''); ?> <article id="post-<?php the_ID(); ?> " <?php post_class(array('modern-item', $term_list)); ?> data-post-id="<?php the_ID(); ?> "> <div class="modern-item-bg" style="background-image:url(<?php
<?php /** * Share links */ $text = wolf_get_theme_option('share_text'); $link = get_permalink(); $title = urlencode(get_the_title()); $pin_img = wolf_get_post_thumbnail_url('full'); ?> <div class="share-box clearfix"> <div class="share-box-inner clearfix"> <div class="share-box-title"> <h5 class="share-title"><?php echo sanitize_text_field($text); ?> </h5> </div><!-- .share-box-title --> <div class="share-box-links-container"> <?php if (wolf_get_theme_option('share_facebook')) { ?> <a data-popup="true" data-width="580" data-height="320" href="http://www.facebook.com/sharer.php?u=<?php echo esc_url($link); ?> &t=<?php echo esc_attr($title); ?> " class="share-link share-link-facebook" title="<?php printf(__('Share on %s', 'wolf'), 'facebook'); ?>
/** * Displays navigation to next/previous work post when applicable. * */ function wolf_post_nav() { global $post; // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } $next_post = get_next_post(); $prev_post = get_previous_post(); ?> <nav class="nav-single clearfix"> <div class="nav-previous"<?php if (!empty($prev_post) && wolf_get_post_thumbnail_url('large', $prev_post->ID)) { ?> data-bg="<?php echo esc_url(wolf_get_post_thumbnail_url('large', $prev_post->ID)); ?> " <?php } ?> > <?php previous_post_link('%link', '<span class="nav-label">' . __('Previous post', 'wolf') . '</span><span class="meta-nav"></span> %title'); ?> </div> <div class="nav-next"<?php if (!empty($next_post) && wolf_get_post_thumbnail_url('large', $next_post->ID)) { ?> data-bg="<?php echo esc_url(wolf_get_post_thumbnail_url('large', $next_post->ID)); ?> " <?php } ?> > <?php next_post_link('%link', '<span class="nav-label">' . __('Next post', 'wolf') . '</span> %title <span class="meta-nav"></span>'); ?> </div> </nav><!-- .nav-single --> <?php }