Example #1
0
    // If not viewing a single post.
    ?>

		<?php 
    get_the_image(array('size' => 'stargazer-full'));
    ?>

		<header class="entry-header">

			<?php 
    the_title('<h2 ' . hybrid_get_attr('entry-title') . '><a href="' . get_permalink() . '" rel="bookmark" itemprop="url">', '</a></h2>');
    ?>

			<div class="entry-byline">
				<?php 
    hybrid_post_format_link();
    ?>
				<span <?php 
    hybrid_attr('entry-author');
    ?>
><?php 
    the_author_posts_link();
    ?>
</span>
				<time <?php 
    hybrid_attr('entry-published');
    ?>
><?php 
    echo get_the_date();
    ?>
</time>
Example #2
0
    /**
     * Outputs the widget based on the arguments input through the widget controls.
     *
     * @since  1.0.0
     * @access public
     * @param  array  $sidebar
     * @param  array  $instance
     * @return void
     */
    function widget($sidebar, $instance)
    {
        $args = wp_parse_args($instance, $this->defaults);
        /* Set up tabs. */
        $tabs = array();
        if (0 < $args['recent_posts_number']) {
            $tabs['recent'] = __('Recent Posts', 'ravel');
        }
        if (0 < $args['popular_posts_number']) {
            $tabs['popular'] = __('Popular Posts', 'ravel');
        }
        if (0 < $args['recent_comments_number']) {
            $tabs['comments'] = __('Recent Comments', 'ravel');
        }
        if (0 < $args['tag_cloud_number']) {
            $tabs['tags'] = __('Tags', 'ravel');
        }
        if (empty($tabs)) {
            return;
        }
        /* Output the sidebar's $before_widget wrapper. */
        echo $sidebar['before_widget'];
        /* If a title was input by the user, display it. */
        if (!empty($args['title'])) {
            echo $sidebar['before_title'] . apply_filters('widget_title', $args['title'], $instance, $this->id_base) . $sidebar['after_title'];
        }
        ?>

		<ul class="tabs-nav">
			<?php 
        foreach ($tabs as $tab => $label) {
            ?>
				<?php 
            printf('<li class="tab-%s tab-title"><a href="#%s" title="%3$s"><span>%3$s</span></a></li>', esc_attr($tab), esc_attr("{$this->id_base}-{$tab}"), esc_attr($label));
            ?>
			<?php 
        }
        ?>
		</ul><!-- .tabs-nav -->

		<div class="tabs-container">

			<?php 
        if (0 < $args['recent_posts_number']) {
            ?>

				<?php 
            $loop = new WP_Query(array('posts_per_page' => $args['recent_posts_number'], 'ignore_sticky_posts' => true));
            ?>

				<ul id="<?php 
            echo esc_attr($this->id_base);
            ?>
-recent" class="tabs-panel">

					<?php 
            while ($loop->have_posts()) {
                ?>

						<?php 
                $loop->the_post();
                ?>

						<li>
							<?php 
                get_the_image(array('size' => 'post-thumbnail', 'before' => '<div class="tab-thumbnail">', 'after' => '</div>'));
                ?>

							<div class="tab-content">

								<div class="tab-post-format">
									<?php 
                hybrid_post_format_link();
                ?>
								</div><!-- .tab-post-format -->

								<?php 
                the_title('<div class="tab-title"><a href="' . get_permalink() . '">', '</a></div>');
                ?>

								<div class="tab-date"><?php 
                echo get_the_date();
                ?>
</div>

							</div><!-- .tab-content -->
						</li>

					<?php 
            }
            ?>
				</ul>

			<?php 
        }
        // End check to display recent posts.
        ?>

			<?php 
        if (0 < $args['popular_posts_number']) {
            ?>

				<?php 
            $loop = new WP_Query(array('posts_per_page' => $args['popular_posts_number'], 'orderby' => 'comment_count', 'ignore_sticky_posts' => true, 'date_query' => array(array('after' => 1 === $args['popular_past_months'] ? '1 month ago' : sprintf('%s months ago', $args['popular_past_months'])))));
            ?>

				<ul id="<?php 
            echo esc_attr($this->id_base);
            ?>
-popular" class="tabs-panel">

					<?php 
            while ($loop->have_posts()) {
                ?>

						<?php 
                $loop->the_post();
                ?>

						<li>
							<?php 
                get_the_image(array('size' => 'post-thumbnail', 'before' => '<div class="tab-thumbnail">', 'after' => '</div>'));
                ?>

							<div class="tab-content">

								<div class="tab-post-format">
									<?php 
                hybrid_post_format_link();
                ?>
								</div><!-- .tab-post-format -->

								<?php 
                the_title('<div class="tab-title"><a href="' . get_permalink() . '">', '</a></div>');
                ?>

								<div class="tab-date"><?php 
                echo get_the_date();
                ?>
</div>

							</div><!-- .tab-content -->
						</li>

					<?php 
            }
            ?>
				</ul>

			<?php 
        }
        // End popular posts check.
        ?>

			<?php 
        if (0 < $args['recent_comments_number']) {
            ?>

				<?php 
            $comments = get_comments(array('number' => $args['recent_comments_number'], 'status' => 'approve'));
            ?>

				<?php 
            if (!empty($comments)) {
                ?>

					<ul id="<?php 
                echo esc_attr($this->id_base);
                ?>
-comments" class="tabs-panel">

						<?php 
                foreach ($comments as $comment) {
                    ?>

							<li>
								<div class="tab-thumbnail avatar">
									<?php 
                    printf('<a href="%s">%s</a>', esc_url(get_comment_link($comment->comment_ID)), get_avatar($comment->comment_author_email, 96));
                    ?>
								</div>

								<div class="tab-content">
									<div class="tab-author">
										<cite><?php 
                    comment_author($comment->comment_ID);
                    ?>
</cite>
									</div>
									<div class="tab-comment">
										<a href="<?php 
                    echo esc_url(get_comment_link($comment->comment_ID));
                    ?>
">
											<?php 
                    comment_excerpt($comment->comment_ID);
                    ?>
										</a>
									</div>	
								</div><!-- .tab-content -->
							</li>

						<?php 
                }
                ?>

					</ul><!--.tabs-panel-->

				<?php 
            }
            // End if have comments check.
            ?>

			<?php 
        }
        // End check for comments display.
        ?>

			<?php 
        if (0 < $args['tag_cloud_number']) {
            ?>

				<ul id="<?php 
            echo esc_attr($this->id_base);
            ?>
-tags" class="tabs-panel">
					<li>
						<?php 
            wp_tag_cloud(array('number' => $args['tag_cloud_number']));
            ?>
					</li>
				</ul><!-- .tabs-panel -->

			<?php 
        }
        // End check for display of tag cloud.
        ?>

		</div><!-- .tabs-container -->
		<?php 
        /* Close the sidebar's widget wrapper. */
        echo $sidebar['after_widget'];
    }