</div>
					<?php 
        }
        ?>
					<h1 class="entry-title"><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        printf(__('Read, comment and share &ldquo;%s&rdquo;', 'panamazonica'), the_title_attribute('echo=0'));
        ?>
" rel="bookmark"><?php 
        the_title();
        ?>
</a></h1>	
				    <?php 
        if ($autor = panamazonica_get_documento_meta('_pan_autor')) {
            ?>
<small>/ Por <?php 
            echo $autor;
            ?>
</small><?php 
        }
        ?>
				</header>
				
				<div class="entry-summary">
		        	<?php 
        the_excerpt();
        ?>
		        </div><!-- /entry-summary -->
			         
Beispiel #2
0
    /**
     * Outputs the HTML for this widget.
     *
     * @param array An array of standard parameters for widgets in this theme
     * @param array An array of settings for this widget instance
     * @return void Echoes it's output
     **/
    function widget($args, $instance)
    {
        $cache = wp_cache_get('widget_documentos', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = null;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args, EXTR_SKIP);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Published Documents', 'panamazonica') : $instance['title'], $instance, $this->id_base);
        // Número de posts
        if (!isset($instance['number'])) {
            $instance['number'] = '3';
        }
        if (!($number = absint($instance['number']))) {
            $number = 3;
        }
        $args = array('post_type' => 'documento', 'posts_per_page' => $number, 'post_status' => 'publish');
        $documentos = new WP_Query($args);
        if ($documentos->have_posts()) {
            echo $before_widget;
            echo $before_title;
            echo '<a href="' . get_post_type_archive_link('documento') . '" title="' . __('See all Published Documents', 'panamazonica') . '">' . $title . '</a>';
            echo $after_title;
            while ($documentos->have_posts()) {
                $documentos->the_post();
                ?>
    	
			<article>
				<h2 class="entry-title">
					<a href="<?php 
                the_permalink();
                ?>
">
						<?php 
                the_title();
                ?>
						<?php 
                if ($autor = panamazonica_get_documento_meta('_pan_autor')) {
                    ?>
<small><?php 
                    printf(__('By %s', 'panamazonica'), $autor);
                    ?>
</small><?php 
                }
                ?>
					</a>
					
				</h2>
			</article>
		    	
			<?php 
            }
            ?>
			
			<a href="<?php 
            echo get_post_type_archive_link('documento');
            ?>
" class="read-more"><?php 
            _e('See all Published Documents', 'panamazonica');
            ?>
</a>
			
			<?php 
            // Final do widget
            echo $after_widget;
            // Reinicia o postdata
            wp_reset_postdata();
        }
        // if ( have_posts() )
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_documentos', $cache, 'widget');
    }