/**
  * Image Slider shortcode
  *
  * @param array $atts
  * @return string
  */
 function wolf_shortcode_images_slider($atts, $content = null)
 {
     if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) {
         $atts = vc_map_get_attributes('wolf_images_slider', $atts);
     }
     extract(shortcode_atts(array('ids' => '', 'layout' => 'default', 'autoplay' => '', 'transition' => 'auto', 'animation' => '', 'animation_delay' => '', 'autoplay' => 'yes', 'transition' => 'auto', 'slideshow_speed' => 4000, 'pause_on_hover' => 'yes', 'nav_bullets' => 'yes', 'nav_arrows' => 'yes', 'inline_style' => '', 'class' => ''), $atts));
     $images = explode(',', $ids);
     $size = 'default' == $layout ? 'slide' : 'slide-' . $layout;
     $style = '';
     $class = $class ? "{$class} " : '';
     // add space
     $class .= "wolf-images-slider-container slider-background-{$layout}";
     if ($animation) {
         $class .= " wow {$animation}";
     }
     if ($animation_delay && 'none' != $animation) {
         $style .= 'animation-delay:' . absint($animation_delay) / 1000 . 's;-webkit-animation-delay:' . absint($animation_delay) / 1000 . 's;';
     }
     if ($inline_style) {
         $style .= $inline_style;
     }
     $style = $style ? " style='{$style}'" : '';
     $slider_data = "data-pause-on-hover='{$autoplay}'\r\n\t\tdata-autoplay='{$autoplay}'\r\n\t\tdata-transition='{$transition}'\r\n\t\tdata-slideshow-speed='{$slideshow_speed}'\r\n\t\tdata-nav-arrows='{$nav_arrows}'\r\n\t\tdata-nav-bullets='{$nav_bullets}'";
     $output = '';
     $output .= "<div class='wolf-slider-style-container'{$style}>";
     $output .= "<div class='{$class}'>";
     $output .= "<div {$slider_data} class='flexslider wolf-images-slider'>";
     $output .= '<ul class="slides">';
     foreach ($images as $image_id) {
         $attachment = get_post($image_id);
         $image_url = esc_url(wolf_get_url_from_attachment_id($image_id, $size));
         $full_size = esc_url(wolf_get_url_from_attachment_id($image_id, 'extra-large'));
         $title = $attachment ? wptexturize($attachment->post_title) : '';
         $alt = $attachment ? esc_attr(get_post_meta($attachment->ID, '_wp_attachment_image_alt', true)) : '';
         $alt = $alt ? $alt : $title;
         $post_excerpt = $attachment ? wolf_sample(wptexturize($attachment->post_excerpt), 88) : '';
         $output .= '<li class="slide">';
         $output .= "<img src='{$image_url}' alt='{$alt}'>";
         if ($post_excerpt) {
             $output .= "<p class='flex-caption'>{$post_excerpt}</p>";
         }
         $output .= '</li>';
     }
     $output .= '</ul>';
     $output .= '</div>';
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }
        /**
         * Output the last new feature if set in the changelog XML
         *
         * @access public
         * @return void
         */
        public function features()
        {
            $theme_name = WOLF_THEME_NAME;
            $twitter_url = 'http://' . WOLF_DOMAIN . '/theme/' . wolf_get_theme_slug();
            $twitter_text = 'Make your website look awesome with ' . WOLF_THEME_NAME . ' #wordpress #theme by @wolf_themes';
            if (wolf_get_theme_description_from_changelog()) {
                $desc = wolf_sample(wolf_get_theme_description_from_changelog(), 50);
                $twitter_text = "Check out '{$theme_name} &mdash; {$desc}' on #EnvatoMarket by @wolf_themes #themeforest";
            }
            if (wolf_get_theme_short_link()) {
                $twitter_url = wolf_get_theme_short_link();
            }
            ?>
			<p class="wolf-about-actions">
				<a href="<?php 
            echo esc_url(admin_url('admin.php?page=wolf-theme-options'));
            ?>
" class="button button-primary"><?php 
            _e('Settings', 'wolf');
            ?>
</a>
				<a
					style="margin-right:3px;margin-top:3px;vertical-align:middle"
					href="https://twitter.com/share"
					data-text="<?php 
            echo sanitize_text_field($twitter_text);
            ?>
"
					data-url="<?php 
            echo esc_url($twitter_url);
            ?>
"
					class="twitter-share-button"
					data-count="none"
					data-size="large">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
			</p>
			<?php 
        }
	</div>
	<?php 
}
?>
	<div class="video-description video-inner">
		<div class="entry-meta">
			<span class="fa fa-clock-o"></span><?php 
printf(__('Uploaded %s ago', 'wolf'), human_time_diff(get_the_time('U'), current_time('timestamp')));
?>
		</div>
		<?php 
if (wolf_sample(wolf_no_video_content())) {
    ?>
			<div class="video-excerpt">
				<p><?php 
    echo wolf_sample(wolf_no_video_content());
    ?>
</p>
				<span class="video-read-more"><?php 
    _e('more', 'wolf');
    ?>
</span>
			</div>
			<div class="video-content">
				<?php 
    echo wolf_no_video_content();
    ?>
				<div class="entry-meta">
					<?php 
    echo get_the_term_list($post_id, 'video_type', '<span class="fa fa-folder-o"></span>', __(', ', 'wolf'), '');
    ?>
Пример #4
0
 /**
  * Returns the first quote in post
  *
  * @access public
  * @return string
  */
 function wolf_featured_quote()
 {
     global $post;
     $quote = null;
     $has_quote = preg_match('#<blockquote[^>]*>([^<]+|<(?!/?blockquote)[^>]*>|(?R))+</blockquote>#', $post->post_content, $match);
     if ($has_quote) {
         $quote = $match[0];
         if (!is_single()) {
             $quote = '<blockquote class="featured-quote">' . wolf_sample($match[1]) . '</blockquote>';
         }
     }
     return $quote;
 }
<?php

$post_id = get_the_ID();
$post_type = get_post_type();
?>
<span class="wolf-slide-caption-container">
	<span class="wolf-slide-caption">
		<span class="wrap">
			<span data-max-font-size="48" class="fittext wolf-slide-title"><?php 
the_title();
?>
</span>
			<span class="wolf-slide-subtitle"><?php 
echo sanitize_text_field(wolf_sample(wolf_excerpt(false), 140));
?>
</span>
			<span class="wolf-slide-button-container">
				<a href="<?php 
the_permalink();
?>
" class="wolf-button border-button medium square in-site"><?php 
echo sanitize_text_field(wolf_more_text());
?>
</a>
			</span>
			<?php 
edit_post_link(__('Edit', 'wolf'), '<span class="edit-link">', '</span>');
?>
		</span><!-- .wrap -->
	</span><!-- .wolf-slide-caption -->
</span><!-- .wolf-slide-caption-container -->
 /**
  * Generate a mosaic carouel layout gallery
  *
  * @access public
  * @param array $images
  * @param string $link
  * @param string $hover_effect
  * @param string $orderby
  * @param bool $carousel
  * @return string $output
  */
 function wolf_mosaic_gallery($images = array(), $link = 'file', $hover_effect = 'default', $orderby = '', $carousel = true, $inline_style = '', $class = '')
 {
     if ('rand' == $orderby) {
         shuffle($images);
     }
     $rand_id = rand(0, 999);
     $selector = "gallery-{$rand_id}";
     $style = '';
     $class = $class ? "{$class} " : '';
     // add space
     $class .= "wolf-images-gallery clearfix hover-{$hover_effect}";
     if ($carousel) {
         $class .= " carousel-mosaic-gallery owl-carousel";
     } else {
         $class .= " mosaic-gallery";
     }
     if ($inline_style) {
         $style .= $inline_style;
     }
     $style = $style ? " style='{$style}'" : '';
     $output = "<div class='{$class}' id='{$selector}'{$style}>";
     $i = 0;
     foreach ($images as $image_id) {
         if ($i % 6 == 0) {
             if ($i == 0) {
                 $output .= "\n";
                 $output .= '<div class="slide block">';
                 $output .= "\n";
             } elseif ($i != count($images)) {
                 $output .= '</div><!--.block-->';
                 $output .= "\n";
                 $output .= '<div class="slide block">';
                 $output .= "\n";
             } else {
                 $output .= '</div><!--.block-->';
                 $output .= "\n";
             }
         }
         /* Images sizes */
         if ($i % 6 == 1) {
             $size = '2x1';
         } elseif ($i % 6 == 3) {
             $size = '1x2';
         } elseif ($i % 6 == 5) {
             $size = '2x1';
         } else {
             $size = '2x2';
         }
         $i++;
         $attachment = get_post($image_id);
         if ($attachment) {
             $image_url = esc_url(wolf_get_url_from_attachment_id($image_id, $size));
             $file = esc_url(wolf_get_url_from_attachment_id($image_id, 'extra-large'));
             $image_page = get_attachment_link($image_id);
             $href = 'post' == $link || 'attachment' == $link ? $image_page : $file;
             $class = 'file' == $link ? 'lightbox image-item' : 'image-item';
             $title = wptexturize($attachment->post_title);
             $post_excerpt = esc_attr(wolf_sample(wptexturize($attachment->post_excerpt), 88));
             $title_attr = $post_excerpt ? " title='{$post_excerpt}'" : '';
             if ('none' != $link) {
                 $output .= "<a{$title_attr} href='{$href}' class='{$class}' rel='{$selector}'>";
                 $output .= "\n";
             } else {
                 $output .= "<span class='{$class}'>";
                 $output .= "\n";
             }
             $output .= "<img src='{$image_url}' alt='{$title}'>";
             $output .= "\n";
             if ('none' != $link) {
                 $output .= '</a>';
                 $output .= "\n";
             } else {
                 $output .= '</span>';
                 $output .= "\n";
             }
         }
     }
     // end for each
     $output .= '</div><!--.block-->';
     $output .= "\n";
     $output .= '</div><!--.wolf-images-gallery-->';
     if (array() != $images) {
         return $output;
     }
 }