Exemple #1
0
 * Used for both single and index/archive/search.
 *
 * @package Maisha
 * @since Maisha 1.0
 */
?>
<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>
	<?php 
// Post thumbnail.
maisha_post_thumbnail();
?>

	<header class="entry-header">
		<?php 
if (is_single()) {
    the_title('<h1 class="entry-title">', '</h1>');
} else {
    the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
}
?>
	</header><!-- .entry-header -->

    <?php 
if (!get_theme_mod('maisha_post_footer')) {
    ?>
Exemple #2
0
    function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        $postnumber = $instance['postnumber'];
        $category = apply_filters('widget_title', $instance['category']);
        echo $args['before_widget'];
        ?>
		<?php 
        if (!empty($title)) {
            echo '<div class="widget-title-wrap"><h3 class="widget-title"><span>' . esc_html($title) . '</span></h3></div>';
        }
        // The Query
        $recent_query = new WP_Query(array('post_status' => 'publish', 'posts_per_page' => $postnumber, 'ignore_sticky_posts' => 1, 'category_name' => $category));
        // The Loop
        if ($recent_query->have_posts()) {
            ?>
   <div class="clearfix">
   <?php 
            while ($recent_query->have_posts()) {
                $recent_query->the_post();
                ?>
   <div class="sixcolumn clearfix">
        <article id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class();
                ?>
>
            <div class="entry-content">
                <figure>
                <a href="<?php 
                the_permalink();
                ?>
">
                <?php 
                // Post thumbnail.
                maisha_post_thumbnail();
                ?>
                </a>
                <figcaption>
                <header class="entry-header">
                    <h2 class="entry-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
                </header><!-- .entry-header -->
                </figcaption>
                </figure>
            </div>
        </article><!-- #post-## -->
    </div>
   <?php 
            }
            ?>
   </div>
<?php 
        }
        ?>
	   <?php 
        echo $args['after_widget'];
        // Reset the post globals as this query will have stomped on it
        wp_reset_postdata();
    }