コード例 #1
0
    function element()
    {
        $category = $this->opt('category') ? $this->opt('category') : '0';
        $posts_per_page = $this->opt('post_per_page') ? $this->opt('post_per_page') : '8';
        // How many posts to load
        $autoScroll = $this->opt('auto_scroll') === 'yes' ? 'true' : 'false';
        $timeout_duration = $this->opt('timeout_duration') ? $this->opt('timeout_duration') : '2500';
        //** Appear animation
        $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : '';
        global $post;
        $args = array('post_type' => 'portfolio', 'posts_per_page' => $posts_per_page);
        if ($category != '0') {
            $args['tax_query'] = array(array('taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $category));
        }
        $portfolio_items = get_posts($args);
        ?>

		<?php 
        if (empty($portfolio_items)) {
            echo '<div class="zn-pb-notification">Please configure the element options and select at least one category.</div>';
            return;
        }
        ?>

            <div class="latestWorkContainer carouselContainer noTouch <?php 
        echo $this->data['uid'];
        ?>
" <?php 
        echo $appear;
        ?>
>
                <ul class="latestWorkCarousel clearfix" data-auto="<?php 
        echo $autoScroll;
        ?>
" data-duration="<?php 
        echo $timeout_duration;
        ?>
">

					<?php 
        foreach ($portfolio_items as $post) {
            setup_postdata($post);
            if (has_post_thumbnail()) {
                $image = zn_get_post_image($post->ID, 465, 590, array('class' => 'img-responsive animate'));
            }
            //$posttags = wp_get_post_tags( get_the_ID());
            $posttags = get_the_terms(get_the_ID(), 'portfolio_categories');
            $postTagsText = '';
            if ($posttags) {
                foreach ($posttags as $tag) {
                    $postTagsText .= $tag->name . ' / ';
                }
            }
            $postTagsText = rtrim($postTagsText, " / ");
            //<!--PORTFOLIO ITEM-->
            ?>
		                    
		                    <li class="animate" onClick="location.href='<?php 
            the_permalink();
            ?>
'">

		                    	<?php 
            if (isset($image)) {
                ?>
			                        <div class="scaleRotateImg">
			                            <?php 
                echo $image;
                ?>
			                        </div>
								<?php 
            }
            ?>

		                        <div class="lwContent">
		                            <h3 class="titleColor animate"><?php 
            the_title();
            ?>
</h3>
		                            <h4 class="descriptionColor"><?php 
            echo $postTagsText;
            ?>
</h4>
		                            <?php 
            the_excerpt();
            ?>
		                            <a href="#" class="arrowLink arrowRight titleColor"><?php 
            _e('View details', 'zn_framework');
            ?>
</a>
		                        </div>
		                    </li>
		                    
							<?php 
            //<!--END PORTFOLIO ITEM-->
        }
        wp_reset_query();
        ?>

                </ul>
                <span class="Prev animate">
                    <img alt="Previous" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/prevDark.png" />
                </span>
                <span class="Next animate">
                    <img alt="Next" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/nextDark.png" />
                </span>
            </div>
	<?php 
    }
コード例 #2
0
<?php

global $zn_config;
$size = zn_get_wp_image_size($zn_config['size']);
$post_data['media'] = zn_get_post_image(get_the_ID(), $size['width'], $size['height'], array('class' => "img-responsive animate"));
$post_data['media'] = !empty($post_data['media']) ? '<div class="mediaContainer scaleRotateImg">' . $post_data['media'] . '</div>' : '';
?>
<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>
	<?php 
// Page thumbnail.
if (!post_password_required() || has_post_thumbnail()) {
    echo '<div class="article_media">';
    echo $post_data['media'];
    echo '</div>';
}
?>

	<div class="article_content textLight">
		<?php 
the_content();
wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'zn_framework') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>'));
?>
	</div><!-- .entry-content -->
</article><!-- #post-## -->
<div class="zn_blog_separator clearfix"></div>
コード例 #3
0
<?php

if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo '<article id="post-' . get_the_ID() . '" class="row clearfix ' . implode(' ', get_post_class()) . '">';
        $container_class = 'col-sm-12';
        if (has_post_thumbnail()) {
            $container_class = 'col-sm-9';
            echo '<div class="col-sm-3">';
            echo zn_get_post_image(get_the_id(), '270', '170');
            echo '</div>';
        }
        echo '<div class="' . $container_class . '">';
        // ARTICLE TITLE
        echo '<h3 class="article_title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
        // ARTICLE META
        echo zn_get_the_meta();
        // POST CONTENT
        $excerpt = trim(get_the_excerpt());
        if (!empty($excerpt)) {
            the_excerpt();
            echo '<a href="' . get_permalink() . '" rel="bookmark"><span class="arrowLink arrowRight">' . __('Continue reading', 'zn_framework') . '</span></a>';
        } else {
            $excerpt = strip_shortcodes(get_the_content());
            $excerpt = apply_filters('the_excerpt', $excerpt);
            $excerpt = str_replace(']]>', ']]&gt;', $excerpt);
            echo $excerpt;
            if (!empty($excerpt)) {
                echo '<a href="' . get_permalink() . '" rel="bookmark"><span class="arrowLink arrowRight">' . __('Continue reading', 'zn_framework') . '</span></a>';
            }
コード例 #4
0
<?php

if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo '<article id="post-' . get_the_ID() . '" class="clearfix ' . implode(' ', get_post_class()) . '">';
        global $zn_config;
        $image_size = zn_get_wp_image_size($zn_config['size']);
        // FEATURED IMAGE
        if (has_post_thumbnail()) {
            $image = zn_get_post_image($post->ID, $image_size['width'], $image_size['height'], array('class' => 'img-responsive animate'));
            echo '<a class="scaleRotateImg portfolio_image" href="' . get_permalink() . '" title="' . get_the_title() . '">' . $image . '</a>';
        }
        // POST META
        ?>
				
				<div class="portfolio_article_content textLight">
					<!-- ARTICLE TITLE -->
					<h3 class="article_title"><?php 
        the_title();
        ?>
</h3>
					
					<!-- ARTICLE CONTENT -->
					<?php 
        the_content();
        ?>
				</div>

			</article>
コード例 #5
0
 function zn_setup_post_data($post_format)
 {
     global $zn_config, $post;
     $content_type = !empty($zn_config['blog_content']) ? $zn_config['blog_content'] : 'content';
     $imgBig = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
     $size = zn_get_wp_image_size($zn_config['size']);
     $imgAttr = array('data-mfp-src' => $imgBig, 'class' => "img-responsive animate magPopupImg");
     $post_data['media'] = zn_get_post_image(get_the_ID(), $size['width'], $size['height'], $imgAttr);
     //$post_data['media']   = get_the_post_thumbnail(get_the_ID(), $zn_config['size'] , array( 'class' => 'animate img-responsive magPopupImg' , 'data-mfp-src' => wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) ));
     $post_data['title'] = get_the_title();
     $post_data['content'] = $content_type == 'content' ? get_the_content('<span class="arrowLink arrowRight">' . __('Continue reading', 'zn_framework') . '</span>') : get_the_excerpt();
     //$post_data['content'] = get_the_excerpt();
     $post_data['meta'] = zn_get_the_meta();
     // Separate post content and media
     $post_data = apply_filters('post-format-' . $post_format, $post_data, $zn_config['size']);
     // Apply the 'the_content' filter
     $post_data['content'] = apply_filters('the_content', $post_data['content']);
     // TRIM THE CONTENT FOR SPECIAL PAGEBUILDEr ELEMENTS
     if (!empty($zn_config['trim_content'])) {
         $post_data['content'] = zn_trim_content($post_data['content']);
     }
     // HIDE THE POST META FOR SPECIAL PAGE BUILDEr ELEMENETS
     if (!empty($zn_config['hide_post_meta']) && $zn_config['hide_post_meta'] == true) {
         $post_data['meta'] = '';
     }
     // WRAP POST MEDIA
     if ($post_format == 'video' || $post_format == 'gallery' || $post_format == 'standard') {
         $media_cls = 'scaleRotateImg';
     } else {
         $media_cls = '';
     }
     //** Appear animation
     $blog_media_delay = zget_option('blog_media_delay', 'blog_options');
     $blog_media_animation = zget_option('blog_media_animation', 'blog_options');
     $appear_delay = $blog_media_delay ? $blog_media_delay : '0';
     $appear = $blog_media_animation ? $blog_media_animation : '';
     if (!empty($appear)) {
         $appear = 'data-appear="fade-in" data-appear-direction="' . $appear . '" data-appear-delay="' . $appear_delay . '"';
     }
     $post_data['media'] = !empty($post_data['media']) ? '<div class="mediaContainer ' . $media_cls . '" ' . $appear . '>' . $post_data['media'] . '</div>' : '';
     // CHECK TO SEE IF WE NEED TO WRAP THE ARTICLE
     $post_data['before'] = is_single() ? '' : '<div class="' . $zn_config['columns'] . ' article_container animate" >';
     $post_data['after'] = is_single() ? '' : '</div>';
     return $post_data;
 }
コード例 #6
0
    function element()
    {
        global $post, $zn_framework;
        $columns_num = $this->opt('columns_num') ? $this->opt('columns_num') : '3';
        $columns_class = zn_get_col_size($columns_num);
        $underline = $this->opt('use_underline') !== 'zn_dummy_value' ? true : false;
        $title = $this->opt('title') ? '<span ' . ($underline ? 'class="underline"' : '') . '>' . $this->opt('title') . '</span>' : '';
        $title_style = $this->opt('title_style') ? $this->opt('title_style') : '';
        //** Appear animation
        $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : '';
        $portfolio_items = '';
        $tag_ids = wp_get_post_terms(zn_get_the_id(), 'portfolio_tags', array('fields' => 'ids'));
        if ($tag_ids) {
            $args = array('post_type' => 'portfolio', 'posts_per_page' => $columns_num, 'post__not_in' => array(zn_get_the_id()), 'tax_query' => array(array('taxonomy' => 'portfolio_tags', 'field' => 'id', 'terms' => $tag_ids, 'operator' => 'IN')));
            $portfolio_items = get_posts($args);
        }
        ?>

            <div class="znPortfolioRelated noTouch <?php 
        echo $this->data['uid'];
        ?>
" <?php 
        echo $appear;
        ?>
>
				
				<?php 
        echo '<h3 class="zn_title sectionTitle h1 ' . $title_style . ' ">' . $title . '</h3>';
        ?>

				<?php 
        if (empty($portfolio_items) && $zn_framework->pagebuilder->is_pb_edit) {
            echo '<div class="zn-pb-notification">It seems that there are no related items</div>';
            return;
        } elseif (empty($portfolio_items)) {
            _e('No related items found', 'zn_framework');
            echo '</div>';
            // CLOSING DIV
            return;
        }
        ?>

				<div class="row">
					<div class="smallScreenSliderContainer">
						<span class="Prev animate"><img alt="Previous" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/prevDark.png" /></span>
						<span class="Next animate"><img alt="Next" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/nextDark.png" /></span>
					</div>
					<div class="cloneOnSmallScreens">
				<?php 
        foreach ($portfolio_items as $post) {
            setup_postdata($post);
            ?>

							<!--PORTFOLIO ITEM-->
							<div class="<?php 
            echo $columns_class;
            ?>
">
								<?php 
            // FEATURED IMAGE
            if (has_post_thumbnail()) {
                $image = zn_get_post_image($post->ID, 370, 470, array('class' => 'img-responsive animate'));
                echo '<a class="scaleRotateImg portfolio_image" href="' . get_permalink() . '" title="' . get_the_title() . '">' . $image . '</a>';
            }
            ?>
							</div>
		                    <!--END PORTFOLIO ITEM-->
						<?php 
        }
        wp_reset_query();
        ?>
					</div>
            	</div>
            </div>
	<?php 
    }