Пример #1
0
" title="<?php 
the_title();
?>
">
				<?php 
if (has_post_thumbnail()) {
    ?>
					<?php 
    the_post_thumbnail('thumb-large');
    // only difference to content.php
    ?>
				<?php 
} elseif (hu_is_checked('placeholder')) {
    ?>
					<?php 
    hu_print_placeholder_thumb();
    ?>
				<?php 
}
?>
				<?php 
if (has_post_format('video') && !is_sticky()) {
    echo '<span class="thumb-icon"><i class="fa fa-play"></i></span>';
}
?>
				<?php 
if (has_post_format('audio') && !is_sticky()) {
    echo '<span class="thumb-icon"><i class="fa fa-volume-up"></i></span>';
}
?>
				<?php 
Пример #2
0
    public function widget($args, $instance)
    {
        extract($args);
        $defaults = $this->hu_get_defaults();
        $instance = wp_parse_args((array) $instance, $defaults);
        $title = apply_filters('widget_title', $instance['title']);
        $output = $before_widget . "\n";
        if ($title) {
            $output .= $before_title . $title . $after_title;
        }
        ob_start();
        ?>

	<?php 
        $posts = new WP_Query(array('post_type' => array('post'), 'showposts' => $instance['posts_num'], 'cat' => $instance['posts_cat_id'], 'ignore_sticky_posts' => true, 'orderby' => $instance['posts_orderby'], 'order' => 'dsc', 'date_query' => array(array('after' => $instance['posts_time']))));
        ?>

	<ul class="alx-posts group <?php 
        if ($instance['posts_thumb']) {
            echo 'thumbs-enabled';
        }
        ?>
">
		<?php 
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
		<li>

			<?php 
            if ($instance['posts_thumb']) {
                // Thumbnails enabled?
                ?>
			<div class="post-item-thumbnail">
				<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
					<?php 
                if (has_post_thumbnail()) {
                    ?>
						<?php 
                    the_post_thumbnail('thumb-medium');
                    ?>
					<?php 
                } else {
                    ?>
						<?php 
                    hu_print_placeholder_thumb();
                    ?>
					<?php 
                }
                ?>
					<?php 
                if (has_post_format('video') && !is_sticky()) {
                    echo '<span class="thumb-icon small"><i class="fa fa-play"></i></span>';
                }
                ?>
					<?php 
                if (has_post_format('audio') && !is_sticky()) {
                    echo '<span class="thumb-icon small"><i class="fa fa-volume-up"></i></span>';
                }
                ?>
					<?php 
                if (is_sticky()) {
                    echo '<span class="thumb-icon small"><i class="fa fa-star"></i></span>';
                }
                ?>
				</a>
			</div>
			<?php 
            }
            ?>

			<div class="post-item-inner group">
				<?php 
            if ($instance['posts_category']) {
                ?>
<p class="post-item-category"><?php 
                the_category(' / ');
                ?>
</p><?php 
            }
            ?>
				<p class="post-item-title"><a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></p>
				<?php 
            if ($instance['posts_date']) {
                ?>
<p class="post-item-date"><?php 
                the_time('j M, Y');
                ?>
</p><?php 
            }
            ?>
			</div>

		</li>
		<?php 
        }
        ?>
		<?php 
        wp_reset_postdata();
        ?>
	</ul><!--/.alx-posts-->

<?php 
        $output .= ob_get_clean();
        $output .= $after_widget . "\n";
        echo $output;
    }