Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Banner 200x200
- */
- class Ad200x200 extends WP_Widget {
- /** constructor */
- function Ad200x200() {
- parent::WP_Widget(false, $name = 'Banner 200x200');
- }
- /** @see WP_Widget::widget */
- function widget($args, $instance) {
- extract( $args );
- $title = apply_filters('widget_title', $instance['title']);
- ?>
- <?php echo $before_widget; ?>
- <?php if ( $title )
- echo $before_title . $title . $after_title; ?>
- <?php
- global $pods_cache;
- $pods_cache->enabled = false;
- $anuncio = new Pod('anuncio_b');
- $anuncio->findRecords('rand()', 1);
- $total_anuncios = $anuncio->getTotalRows();
- if( $total_anuncios > 0 ) :
- while ( $anuncio->fetchRecord() ) :
- // set our variables
- $anuncio_anunciante = $anuncio->get_field('name');
- $anuncio_banner_imagem = $anuncio->get_field('banner_imagem.guid');
- $anuncio_banner_flash = $anuncio->get_field('banner_flash.guid');
- if ( $anuncio_banner_flash != "" ) { ?>
- <object width="200" height="200">
- <param name="movie" value="<?php echo $anuncio_banner_flash; ?>">
- <embed src="<?php echo $anuncio_banner_flash; ?>" width="200" height="200">
- </embed>
- <?php }
- else { ?>
- <img src="<?php echo $anuncio_banner_imagem; ?>" />
- <?php } ?>
- <?php endwhile ?>
- <?php endif ?>
- <?php $pods_cache->enabled = true; ?>
- <?php echo $after_widget; ?>
- <?php
- }
- /** @see WP_Widget::update */
- function update($new_instance, $old_instance) {
- $instance = $old_instance;
- $instance['title'] = strip_tags($new_instance['title']);
- return $instance;
- }
- /** @see WP_Widget::form */
- function form($instance) {
- $title = esc_attr($instance['title']);
- ?>
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
- <?php
- }
- } // class Ad200x200
- // register Ad200x200 widget
- add_action('widgets_init', create_function('', 'return register_widget("Ad200x200");'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement