Ejemplo n.º 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;
    }
Ejemplo n.º 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>";
        }
    }
Ejemplo n.º 3
0
    /**
     * Prints HTML with meta information for the categories, tags and comments.
     */
    function sup_entry_footer()
    {
        $posted_on = sup_posted_on();
        $allowed_meta = get_theme_mod('sup_manage_meta', array('author', 'date', 'comment'));
        $byline = sprintf(esc_html_x('%s', 'post author', 'supernova'), '<span class="author vcard">
			<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a>
		 </span>');
        $cat_links = false;
        $tags_list = false;
        // Hide category and tag text for pages.
        if ('post' == get_post_type()) {
            /* translators: used between list items, there is a space after the comma */
            $categories_list = get_the_category_list(esc_html__(', ', 'supernova'));
            if ($categories_list && sup_categorized_blog()) {
                $cat_links = sprintf(esc_html__('%1$s', 'supernova'), $categories_list);
                // WPCS: XSS OK.
            }
            /* translators: used between list items, there is a space after the comma */
            $tags_list = get_the_tag_list('<ul class="sup-tags"><li>', '</li><li>', '</li></ul>');
        }
        if (in_array('author', $allowed_meta)) {
            echo "<span class='byline sup-meta-item sup-icon-user'>{$byline}</span>";
        }
        if (in_array('date', $allowed_meta)) {
            echo "<span class='posted-on sup-meta-item sup-icon-calendar'>{$posted_on}</span>";
        }
        if ($cat_links && in_array('categories', $allowed_meta)) {
            echo "<span class='cat-links sup-meta-item sup-icon-category'>{$cat_links}</span>";
        }
        if ($tags_list && in_array('tags', $allowed_meta)) {
            echo "<span class='tag-links sup-meta-item sup-icon-tags'>{$tags_list}</span>";
        }
        if (!is_single() && !post_password_required() && (comments_open() || get_comments_number()) && in_array('comment', $allowed_meta)) {
            echo '<span class="comments-link sup-meta-item sup-icon-comment">';
            comments_popup_link(esc_html__('Leave a comment', 'supernova'), esc_html__('Comment (1)', 'supernova'), esc_html__('Comments (%)', 'supernova'));
            echo '</span>';
        }
        edit_post_link(esc_html__('Edit', 'supernova'), '<i class="edit-link">', '</i>');
    }