示例#1
0
    echo sanitize_html_class(barcelona_get_post_format());
    ?>
 clearfix">

		<div class="post-image">

			<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
" title="<?php 
    echo esc_attr(get_the_title());
    ?>
">
				<?php 
    barcelona_psum_overlay();
    barcelona_thumbnail('barcelona-lg');
    ?>
			</a>

		</div><!-- .post-image -->

		<div class="post-details">

			<h2 class="post-title">
				<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
"><?php 
    echo esc_html(the_title());
    ?>
</a>
示例#2
0
    echo sanitize_html_class(barcelona_get_post_format());
    ?>
 clearfix">

			<div class="post-image">

				<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
" title="<?php 
    echo esc_attr(get_the_title());
    ?>
">
					<?php 
    barcelona_psum_overlay();
    barcelona_thumbnail('barcelona-md');
    ?>
				</a>

			</div><!-- .post-image -->

			<div class="post-details">

				<h2 class="post-title">
					<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
"><?php 
    echo esc_html(get_the_title());
    ?>
</a>
示例#3
0
while ($barcelona_q->have_posts()) {
    $barcelona_q->the_post();
    $barcelona_post_cat = get_the_category();
    ?>

	<article class="item">

		<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
" title="<?php 
    echo esc_attr(get_the_title());
    ?>
">
			<?php 
    barcelona_thumbnail('barcelona-md', NULL, array('class' => 'trs'));
    ?>
		</a>

		<div class="item-overlay clearfix<?php 
    echo $barcelona_show_overlay ? ' show-always' : '';
    ?>
">

			<div class="inner">

				<div class="post-summary post-format-<?php 
    echo sanitize_html_class(barcelona_get_post_format());
    ?>
">
    public function widget($args, $instance)
    {
        $barcelona_cache = array();
        if (!$this->is_preview()) {
            $barcelona_cache = wp_cache_get('barcelona-slider-posts', 'widget');
        }
        if (!is_array($barcelona_cache)) {
            $barcelona_cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($barcelona_cache[$args['widget_id']])) {
            echo wp_kses_post($barcelona_cache[$args['widget_id']]);
            return;
        }
        ob_start();
        $barcelona_params = array('no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true);
        if (empty($instance['offset']) || !($barcelona_params['offset'] = absint($instance['offset']))) {
            $barcelona_params['offset'] = 0;
        }
        if (empty($instance['number']) || !($barcelona_params['posts_per_page'] = absint($instance['number']))) {
            $barcelona_params['posts_per_page'] = 5;
        }
        /*
         * Filter Posts by Category
         */
        if (!empty($instance['category'])) {
            $barcelona_params['cat'] = $instance['category'];
        }
        /*
         * Filter Posts by Post IDs
         */
        if (!empty($instance['filter_posts'])) {
            $barcelona_params['post__in'] = array_values(array_filter(array_map(function ($v) {
                $v = trim($v);
                if (!is_numeric($v) || $v <= 0) {
                    $v = false;
                }
                return $v;
            }, explode(',', $instance['filter_posts'])), function ($v) {
                return is_numeric($v);
            }));
            if (empty($barcelona_params['post__in'])) {
                unset($barcelona_params['post__in']);
            }
        }
        /*
         * Posts Ordering
         */
        switch ($instance['orderby']) {
            case 'views':
                $barcelona_params['orderby'] = 'meta_value_num';
                $barcelona_params['meta_key'] = '_barcelona_views';
                break;
            case 'comments':
                $barcelona_params['orderby'] = 'comment_count';
                break;
            case 'votes':
                $barcelona_params['orderby'] = 'meta_value_num';
                $barcelona_params['meta_key'] = '_barcelona_vote_up';
                break;
            case 'random':
                $barcelona_params['orderby'] = 'rand';
                break;
            case 'posts':
                $barcelona_params['orderby'] = 'post__in';
                break;
            default:
                $barcelona_params['orderby'] = 'date';
        }
        $barcelona_params['order'] = $instance['order'] != 'asc' ? 'DESC' : 'ASC';
        $barcelona_query = new WP_Query($barcelona_params);
        $barcelona_show_title = $instance['show_title'] == 'on' ? 'on' : 'off';
        if ($barcelona_query->have_posts()) {
            echo wp_kses_post($args['before_widget']);
            if (!empty($instance['title'])) {
                echo wp_kses_post($args['before_title']) . esc_html($instance['title']) . wp_kses_post($args['after_title']);
            }
            $barcelona_owl_data = array('controls' => '.nav-dir', 'items' => 1, 'autoplay' => isset($instance['is_autoplay']) && $instance['is_autoplay'] ? 'true' : 'false', 'rtl' => is_rtl() ? 'true' : 'false');
            ?>
			<div class="posts-box-carousel">

				<div class="owl-carousel owl-theme"<?php 
            echo implode(array_map(function ($v, $k) {
                return ' data-' . sanitize_key($k) . '="' . esc_attr($v) . '"';
            }, $barcelona_owl_data, array_keys($barcelona_owl_data)));
            ?>
>

					<?php 
            while ($barcelona_query->have_posts()) {
                $barcelona_query->the_post();
                $barcelona_post_cat = get_the_category();
                ?>
					<div class="item">

						<a href="<?php 
                echo esc_url(get_the_permalink());
                ?>
" title="<?php 
                echo esc_attr(get_the_title());
                ?>
">
							<?php 
                barcelona_thumbnail('barcelona-md-vertical');
                ?>
						</a>

						<div class="item-overlay clearfix<?php 
                echo $barcelona_show_title == 'on' ? ' show-always' : '';
                ?>
">

							<div class="inner">

								<div class="post-summary post-format-<?php 
                echo sanitize_html_class(barcelona_get_post_format());
                ?>
">

									<?php 
                if (!empty($barcelona_post_cat[0])) {
                    ?>
									<div class="post-cat">
										<a href="<?php 
                    echo esc_url(get_category_link($barcelona_post_cat[0]));
                    ?>
" class="label label-default">
											<?php 
                    echo esc_html($barcelona_post_cat[0]->name);
                    ?>
										</a>
									</div>
									<?php 
                }
                ?>

									<h2 class="post-title">
										<a href="<?php 
                echo esc_url(get_the_permalink());
                ?>
"><?php 
                echo esc_html(get_the_title());
                ?>
</a>
									</h2>

									<ul class="post-meta">
										<li class="post-date">
											<span class="fa fa-clock-o"></span><?php 
                echo esc_html(get_the_time(BARCELONA_DATE_FORMAT));
                ?>
										</li>
									</ul>

								</div>

								<ul class="nav-dir">
									<li><button class="btn"><span class="fa fa-caret-right"></span></button></li>
									<li><button class="btn"><span class="fa fa-caret-left"></span></button></li>
								</ul>

							</div>

						</div>

					</div>
					<?php 
            }
            ?>

				</div><!-- .owl-carousel -->

			</div><!-- .image-slider -->
			<?php 
            echo wp_kses_post($args['after_widget']);
            wp_reset_postdata();
        }
        if (!$this->is_preview()) {
            $barcelona_cache[$args['widget_id']] = ob_get_flush();
            wp_cache_set('barcelona-slider-posts', $barcelona_cache, 'widget');
        } else {
            ob_end_flush();
        }
    }
示例#5
0
" media="(min-width: 768px)" />
							<!--[if IE 9]></video><![endif]-->
							<img src="<?php 
        barcelona_thumbnail_url('barcelona-md');
        ?>
" srcset="<?php 
        barcelona_thumbnail_url('barcelona-md');
        ?>
" alt="<?php 
        echo esc_attr(get_the_title());
        ?>
" />
						</picture>
						<?php 
    } else {
        barcelona_thumbnail('barcelona-xs');
    }
    ?>
				</a>

			</div><!-- .post-image -->

			<div class="post-details">

				<?php 
    if ($barcelona_counter == 0) {
        ?>
					<ul class="post-meta no-sep">
						<li class="post-date">
							<span class="fa fa-clock-o"></span><?php 
        echo esc_html(get_the_time(BARCELONA_DATE_FORMAT));
示例#6
0
				<span class="day"><?php 
    echo intval(get_the_time('d'));
    ?>
</span>
			</div>

			<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
" title="<?php 
    echo esc_attr(get_the_title());
    ?>
">
				<?php 
    barcelona_psum_overlay();
    barcelona_thumbnail('barcelona-sm');
    ?>
			</a>

		</div>
		<!-- .post-image -->

		<div class="post-details">

			<h2 class="post-title">
				<a href="<?php 
    echo esc_url(get_the_permalink());
    ?>
"><?php 
    echo esc_html(get_the_title());
    ?>
    public function widget($args, $instance)
    {
        $barcelona_cache = array();
        if (!$this->is_preview()) {
            $barcelona_cache = wp_cache_get('barcelona-posts', 'widget');
        }
        if (!is_array($barcelona_cache)) {
            $barcelona_cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($barcelona_cache[$args['widget_id']])) {
            echo wp_kses_post($barcelona_cache[$args['widget_id']]);
            return;
        }
        ob_start();
        $barcelona_params = array('no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true);
        if (empty($instance['offset']) || !($barcelona_params['offset'] = absint($instance['offset']))) {
            $barcelona_params['offset'] = 0;
        }
        if (empty($instance['number']) || !($barcelona_params['posts_per_page'] = absint($instance['number']))) {
            $barcelona_params['posts_per_page'] = 5;
        }
        if (!empty($instance['category'])) {
            $barcelona_params['cat'] = $instance['category'];
        }
        if (!empty($instance['filter_posts'])) {
            $barcelona_params['post__in'] = array_values(array_filter(array_map(function ($v) {
                $v = trim($v);
                if (!is_numeric($v) || $v <= 0) {
                    $v = false;
                }
                return $v;
            }, explode(',', $instance['filter_posts'])), function ($v) {
                return is_numeric($v);
            }));
            if (empty($barcelona_params['post__in'])) {
                unset($barcelona_params['post__in']);
            }
        }
        switch ($instance['orderby']) {
            case 'views':
                $barcelona_params['orderby'] = 'meta_value_num';
                $barcelona_params['meta_key'] = '_barcelona_views';
                break;
            case 'comments':
                $barcelona_params['orderby'] = 'comment_count';
                break;
            case 'votes':
                $barcelona_params['orderby'] = 'meta_value_num';
                $barcelona_params['meta_key'] = '_barcelona_vote_up';
                break;
            case 'random':
                $barcelona_params['orderby'] = 'rand';
                break;
            case 'posts':
                $barcelona_params['orderby'] = 'post__in';
                break;
            default:
                $barcelona_params['orderby'] = 'date';
        }
        $barcelona_params['order'] = $instance['order'] != 'asc' ? 'DESC' : 'ASC';
        $barcelona_query = new WP_Query($barcelona_params);
        if ($barcelona_query->have_posts()) {
            echo wp_kses_post($args['before_widget']);
            if (!empty($instance['title'])) {
                echo wp_kses_post($args['before_title']) . esc_html($instance['title']) . wp_kses_post($args['after_title']);
            }
            ?>
			<div class="posts-box posts-box-sidebar row">
			<?php 
            while ($barcelona_query->have_posts()) {
                $barcelona_query->the_post();
                ?>
				<div class="col col-md-12 col-sm-6 col-xs-12">
					<div class="post-summary post-format-<?php 
                echo sanitize_html_class(barcelona_get_post_format());
                ?>
 psum-horizontal psum-small clearfix">
						<div class="post-image">
							<a href="<?php 
                echo esc_url(get_the_permalink());
                ?>
" title="<?php 
                echo esc_attr(get_the_title());
                ?>
">
								<?php 
                barcelona_psum_overlay();
                barcelona_thumbnail('barcelona-md');
                ?>
							</a>
						</div>
						<div class="post-details">
							<h2 class="post-title">
								<a href="<?php 
                echo esc_url(get_the_permalink());
                ?>
"><?php 
                echo esc_html(get_the_title());
                ?>
</a>
							</h2>
							<ul class="post-meta no-sep">
								<li class="post-date">
									<span class="fa fa-clock-o"></span><?php 
                echo esc_html(get_the_time(BARCELONA_DATE_FORMAT));
                ?>
								</li>
							</ul>
						</div>
					</div><!-- .post-summary -->
				</div>
			<?php 
            }
            ?>
			</div>
			<?php 
            echo wp_kses_post($args['after_widget']);
            wp_reset_postdata();
        }
        if (!$this->is_preview()) {
            $barcelona_cache[$args['widget_id']] = ob_get_flush();
            wp_cache_set('barcelona-posts', $barcelona_cache, 'widget');
        } else {
            ob_end_flush();
        }
    }