function render($instance)
    {
        // Get Widget Settings
        $defaults = $this->default_settings();
        extract(wp_parse_args($instance, $defaults));
        // Get latest posts from database
        $query_arguments = array('posts_per_page' => (int) $number, 'ignore_sticky_posts' => true, 'cat' => (int) $category);
        $posts_query = new WP_Query($query_arguments);
        $i = 0;
        // Check if there are posts
        if ($posts_query->have_posts()) {
            // Display Posts
            while ($posts_query->have_posts()) {
                $posts_query->the_post();
                ?>

				<article id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class('single-post');
                ?>
>

					<a href="<?php 
                the_permalink();
                ?>
" rel="bookmark"><?php 
                the_post_thumbnail('featured_image');
                ?>
</a>

					<h3 class="post-title"><a href="<?php 
                the_permalink();
                ?>
" rel="bookmark"><?php 
                the_title();
                ?>
</a></h3>

					<div class="postmeta"><?php 
                dynamicnews_display_postmeta();
                ?>
</div>

					<div class="entry">
						<?php 
                the_excerpt();
                ?>
						<a href="<?php 
                esc_url(the_permalink());
                ?>
" class="more-link"><?php 
                _e('Read more', 'dynamicnewslite');
                ?>
</a>
					</div>

				</article>

			<?php 
            }
        }
        // Reset Postdata
        wp_reset_postdata();
    }
Exemplo n.º 2
0
?>
" <?php 
post_class();
?>
>
		
		<h2 class="post-title entry-title"><a href="<?php 
esc_url(the_permalink());
?>
" rel="bookmark"><?php 
the_title();
?>
</a></h2>
		
		<div class="postmeta clearfix"><?php 
dynamicnews_display_postmeta();
?>
</div>
	
		<?php 
dynamicnews_display_thumbnail_index();
?>
		
		<div class="entry clearfix">
			<?php 
$read_more_text = '<span>' . __('Read more', 'dynamic-news-lite') . '</span>';
?>
			<?php 
the_content($read_more_text);
?>
			<div class="page-links"><?php