/** * 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) { global $post; $cache = wp_cache_get('widget_agenda', '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']) ? 'Agenda' : $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' => 'agenda', 'posts_per_page' => $number, 'post_status' => 'publish'); $args_evento = array_merge($args, array('agenda_tipo' => 'evento')); $args_reuniao = array_merge($args, array('agenda_tipo' => 'reuniao')); $eventos = new WP_Query($args_evento); $reunioes = new WP_Query($args_reuniao); echo $before_widget; ?> <div class="tabs-agenda"> <ul> <li><a href="#eventos"><?php _e('Events', 'panamazonica'); ?> </a></li> <li><a href="#reunioes"><?php _e('Meetings', 'panamazonica'); ?> </a></li> </ul> <?php if ($eventos->have_posts()) { ?> <div id="eventos"> <?php while ($eventos->have_posts()) { $eventos->the_post(); ?> <article> <h2 class="entry-title"> <a href="<?php the_permalink(); ?> "> <?php the_title(); ?> <small><?php echo panamazonica_get_agenda_date($post->ID); ?> </small> </a> </h2> </article> <?php } ?> </div><!-- /eventos --> <?php } ?> <?php if ($reunioes->have_posts()) { ?> <div id="reunioes"> <?php while ($reunioes->have_posts()) { $reunioes->the_post(); ?> <article> <h2 class="entry-title"> <a href="<?php the_permalink(); ?> "> <?php the_title(); ?> <small><?php echo panamazonica_get_agenda_date($post->ID); ?> </small> </a> </h2> </article> <?php } ?> </div><!-- /eventos --> <?php } ?> <a href="<?php echo get_post_type_archive_link('agenda'); ?> " class="read-more"><?php _e('See the Agenda', 'panamazonica'); ?> </a> <?php // Reinicia o postdata wp_reset_postdata(); ?> </div><!-- /tabs-agenda --> <?php // Final do widget echo $after_widget; $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_agenda', $cache, 'widget'); }
" rel="bookmark"><?php the_title(); ?> </a> <?php edit_post_link(__('Edit', 'panamazonica'), '', ''); ?> </h1> </header> <div class="entry-content cf"> <div class="post-type-meta"> <div class="agenda-date"> <?php echo panamazonica_get_agenda_date(); ?> <?php if ($meta_autor = get_post_meta($post->ID, '_pan_horario', true)) { ?> <div class="agenda-time"><?php echo $meta_autor; ?> </div> <?php } ?> </div> <ul class="<?php echo $post->post_type; ?>