示例#1
0
    function widget($arg, $instance)
    {
        extract($arg, EXTR_SKIP);
        $title = isset($instance['title']) ? $instance['title'] : false;
        $number = isset($instance['number']) ? $instance['number'] : false;
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $args = apply_filters('sup_latest_posts_widget_args', array('posts_per_page' => intval($number), 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'orderby' => 'date'), $number);
        $query = new WP_Query($args);
        ?>

			<?php 
        if ($query->have_posts()) {
            ?>
				<ul>
				<?php 
            while ($query->have_posts()) {
                $query->the_post();
                ?>
					<li>
                    	<?php 
                sup_thumbnail('thumbnail', sprintf('<figure class="sup-rp-thumb"><a href="%s">', get_permalink(get_the_ID())), '</a></figure>', true);
                ?>
						<?php 
                the_title(sprintf("<h4 class='sup-rp-title'><a href='%s'>", get_permalink(get_the_ID())), '</a></h4>');
                ?>
						<div class="sup-rp-meta">
							<span class="sup-icon-calendar"></span>
							<?php 
                echo sup_posted_on();
                ?>
						</div>
					</li>
				<?php 
            }
            ?>
				</ul>
		<?php 
        }
        ?>

        <?php 
        echo $after_widget;
    }
示例#2
0
    public function get_posts($tab, $posts_per_page, $show_thumb, $comment_date)
    {
        $args = false;
        switch ($tab) {
            case 'Recent':
                $args = apply_filters('sup_tabber_latest_posts_args', array('posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'orderby' => 'date'), $posts_per_page, $show_thumb, $comment_date);
                break;
            case 'Popular':
                $args = apply_filters('sup_tabber_popluar_posts_args', array('posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'orderby' => 'meta_value_num', 'meta_key' => 'sup_post_views_count'), $posts_per_page, $show_thumb, $comment_date);
                break;
            case 'Recommended':
                $args = apply_filters('sup_tabber_recommended_posts_args', array('posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'orderby' => 'modified', 'meta_key' => 'supernova-recommended-post', 'meta_value' => 1), $posts_per_page, $show_thumb, $comment_date);
                break;
            case 'Random':
                $args = apply_filters('sup_tabber_random_posts_args', array('posts_per_page' => $posts_per_page, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'orderby' => 'rand'), $posts_per_page, $show_thumb, $comment_date);
                break;
        }
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            echo "<ul>";
            while ($query->have_posts()) {
                $query->the_post();
                ?>

                    <li>
                        <?php 
                if ($show_thumb) {
                    sup_thumbnail('thumbnail', sprintf('<figure class="sup-tabber-thumb"><a href="%s">', get_permalink(get_the_ID())), '</a></figure>', true);
                }
                ?>
                         <div class="sup-tabber-right">
                             <?php 
                the_title(sprintf("<h4 class='sup-tabber-title'><a href='%s'>", get_permalink(get_the_ID())), "</a></h4>");
                ?>
                             <span class="sup-tabber-meta">
                             <?php 
                if ($comment_date == 2) {
                    echo '<span class="sup-icon-calendar"></span>' . sup_posted_on();
                }
                if ($comment_date == 1) {
                    echo '<span class="sup-icon-comment"></span>';
                    comments_popup_link(__('Leave A Comment', 'supernova'), __('1 comment', 'supernova'), ' % Comments');
                }
                ?>
                             </span>
                         </div>
                    </li>

                <?php 
            }
            echo "</ul>";
        }
    }
示例#3
0
<article id="post-<?php 
the_ID();
?>
" <?php 
post_class('sup-listing');
?>
>
	<header class="entry-header">
		<?php 
the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
?>
	</header><!-- .entry-header -->

	<div class="entry-content clearfix">
		<?php 
sup_thumbnail('thumbnail', sprintf('<figure class="sup-post-thumb" ><a href="%s">', get_permalink()), '</a></figure>');
?>
		<div class="sup-post-content">
			<?php 
sup_content();
?>
		</div>
		<?php 
wp_link_pages(array('before' => '<div class="page-links">' . esc_html__('Pages:', 'supernova'), 'after' => '</div>'));
?>
	</div><!-- .entry-content -->

	<?php 
if ('post' == get_post_type()) {
    ?>
	<footer class="entry-footer entry-meta clearfix">
示例#4
0
		<?php 
the_title('<h1 class="entry-title">', '</h1>');
?>
		<?php 
do_action('sup_after_title');
?>
	</header><!-- .entry-header -->

	<?php 
sup_create_ad_spot('above_single_post');
?>

	<div class="entry-content clearfix">
		<?php 
if (get_theme_mod('sup_featured_image_on_posts', true)) {
    sup_thumbnail('large');
}
?>
		<?php 
the_content();
?>
		<?php 
wp_link_pages(array('before' => '<div class="page-links">' . esc_html__('Pages:', 'supernova'), 'after' => '</div>'));
?>
	</div><!-- .entry-content -->

	<?php 
sup_create_ad_spot('below_single_post');
?>

	<?php