Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #320054

    Hi there,

    is it possible to display 3 or more pictures with the area widget in the footer?
    i found a post to show only one picture, but i want to add one.
    Hope you can help me and give me the custom css code.

    best regards
    Aku

    #320301

    Hi SennerGrillhaus!

    Thank you for using Enfold.

    You can use multiple Enfold Advertising Area widget. If you want the widget to supply 3 ads instead of 2, edit framework > php > class-framework-widgets.php, remove everything then replace it with this code: http://pastebin.com/fHbqvvuS

    Cheers!
    Ismael

    #527319

    dear ismael,

    it is probably because it is friday: i am not able to change the code so it displays 4 pictures. could u help me out?

    #527333

    Hi!

    Please use the code as following – http://pastebin.com/LAXD0mN0

    Cheers!
    Yigit

    #527357

    nope, still just 3…

    #527359

    Hey!

    Yes, my bad. Please open the file and find

    $this->add_cont = 3;

    and change it to

    $this->add_cont = 4;

    Cheers!
    Yigit

    #529059

    Good Morning!
    nope again, now its displaying just three urls again…

    • This reply was modified 9 years, 1 month ago by aB-Agenta.
    #529073

    I got it! there were some lines missing…here the correct code for 4 images, is others want to use it:

    /**
     * AVIA ADVERTISING WIDGET - 4 Pictures
     *
     * Widget that retrieves, stores and displays the number of twitter and rss followers
     *
     * @package AviaFramework
     * @todo replace the widget system with a dynamic one, based on config files for easier widget creation
     */
     
     
    //multiple images
    if (!class_exists('avia_partner_widget'))
    {
            class avia_partner_widget extends WP_Widget {
     
                    function avia_partner_widget() {
     
                            $this->add_cont = 4;
                            //Constructor
                            $widget_ops = array('classname' => 'avia_partner_widget', 'description' => 'An advertising widget that displays 4 images with 125 x 125 px in size' );
                            $this->WP_Widget( 'avia_partner_widget', THEMENAME.' Advertising Area', $widget_ops );
                    }
     
                    function widget($args, $instance)
                    {
                            extract($args, EXTR_SKIP);
                            echo $before_widget;
     
                            global $kriesiaddwidget, $firsttitle;
                            $kriesiaddwidget ++;
     
                            $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
                            $image_url = empty($instance['image_url']) ? '<span class="avia_parnter_empty"><span>'.__('Advertise here','avia_framework').'</span></span>' : '<img class="rounded" src="'.$instance['image_url'].'" title="" alt=""/>';
                            $ref_url = empty($instance['ref_url']) ? '#' : apply_filters('widget_comments_title', $instance['ref_url']);
                            $image_url2 = empty($instance['image_url2']) ? '<span class="avia_parnter_empty"><span>'.__('Advertise here','avia_framework').'</span></span>' : '<img class="rounded" src="'.$instance['image_url2'].'" title="" alt=""/>';
                            $ref_url2 = empty($instance['ref_url2']) ? '#' : apply_filters('widget_comments_title', $instance['ref_url2']);
                            $image_url3 = empty($instance['image_url3']) ? '<span class="avia_parnter_empty"><span>'.__('Advertise here','avia_framework').'</span></span>' : '<img class="rounded" src="'.$instance['image_url3'].'" title="" alt=""/>';
                            $ref_url3 = empty($instance['ref_url3']) ? '#' : apply_filters('widget_comments_title', $instance['ref_url3']);
                            $image_url4 = empty($instance['image_url4']) ? '<span class="avia_parnter_empty"><span>'.__('Advertise here','avia_framework').'</span></span>' : '<img class="rounded" src="'.$instance['image_url4'].'" title="" alt=""/>';
                            $ref_url4 = empty($instance['ref_url4']) ? '#' : apply_filters('widget_comments_title', $instance['ref_url4']);
     
                            if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
                            echo '<a target="_blank" href="'.$ref_url.'" class="preloading_background  avia_partner1 link_list_item'.$kriesiaddwidget.' '.$firsttitle.'" >'.$image_url.'</a>';
                            if($this->add_cont == 4) echo '<a target="_blank" href="'.$ref_url2.'" class="preloading_background avia_partner2 link_list_item'.$kriesiaddwidget.' '.$firsttitle.'" >'.$image_url2.'</a>';
                 echo '<a target="_blank" href="'.$ref_url3.'" class="preloading_background avia_partner2 link_list_item'.$kriesiaddwidget.' '.$firsttitle.'" >'.$image_url3.'</a>';
                            echo '<a target="_blank" href="'.$ref_url4.'" class="preloading_background avia_partner2 link_list_item'.$kriesiaddwidget.' '.$firsttitle.'" >'.$image_url4.'</a>';
    						echo $after_widget;
     
                            if($title == '')
                            {
                                    $firsttitle = 'no_top_margin';
                            }
     
                    }
     
     
                    function update($new_instance, $old_instance) {
                            //save the widget
                            $instance = $old_instance;
                            foreach($new_instance as $key=>$value)
                            {
                                    $instance[$key] = strip_tags($new_instance[$key]);
                            }
                            return $instance;
                    }
     
     
     
                    function form($instance)
                    {
                            $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'image_url' => '', 'ref_url' => '', 'image_url2' => '', 'ref_url2' => '', 'image_url3' => '', 'ref_url3' => ''  ) );
                            $title = strip_tags($instance['title']);
                            $image_url = strip_tags($instance['image_url']);
                            $ref_url = strip_tags($instance['ref_url']);
                            $image_url2 = strip_tags($instance['image_url2']);
                            $ref_url2 = strip_tags($instance['ref_url2']);
                            $image_url3 = strip_tags($instance['image_url3']);
                            $ref_url3 = strip_tags($instance['ref_url3']);
    						 $image_url4 = strip_tags($instance['image_url4']);
                            $ref_url4 = strip_tags($instance['ref_url4']);
            ?>
                            <p><label for="<?php echo $this->get_field_id('title'); ?>">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 esc_attr($title); ?>" /></label></p>
     
                            <p><label for="<?php echo $this->get_field_id('image_url'); ?>">Image URL: <?php if($this->add_cont == 2) echo "(125px * 125px):"; ?>
                            <input class="widefat" id="<?php echo $this->get_field_id('image_url'); ?>" name="<?php echo $this->get_field_name('image_url'); ?>" type="text" value="<?php echo esc_attr($image_url); ?>" /></label></p>
     
                            <p><label for="<?php echo $this->get_field_id('ref_url'); ?>">Referal URL:
                            <input class="widefat" id="<?php echo $this->get_field_id('ref_url'); ?>" name="<?php echo $this->get_field_name('ref_url'); ?>" type="text" value="<?php echo esc_attr($ref_url); ?>" /></label></p>
     
                            <?php if($this->add_cont == 4)
                            { ?>
     
                                            <p><label for="<?php echo $this->get_field_id('image_url2'); ?>">Image URL 2: (125px * 125px):
                            <input class="widefat" id="<?php echo $this->get_field_id('image_url2'); ?>" name="<?php echo $this->get_field_name('image_url2'); ?>" type="text" value="<?php echo esc_attr($image_url2); ?>" /></label></p>
     
                            <p><label for="<?php echo $this->get_field_id('ref_url2'); ?>">Referal URL 2:
                            <input class="widefat" id="<?php echo $this->get_field_id('ref_url2'); ?>" name="<?php echo $this->get_field_name('ref_url2'); ?>" type="text" value="<?php echo esc_attr($ref_url2); ?>" /></label></p>
               
    						<p><label for="<?php echo $this->get_field_id('image_url3'); ?>">Image URL 3: (125px * 125px):
                            <input class="widefat" id="<?php echo $this->get_field_id('image_url3'); ?>" name="<?php echo $this->get_field_name('image_url3'); ?>" type="text" value="<?php echo esc_attr($image_url3); ?>" /></label></p>
     
                            <p><label for="<?php echo $this->get_field_id('ref_url3'); ?>">Referal URL 3:
                            <input class="widefat" id="<?php echo $this->get_field_id('ref_url3'); ?>" name="<?php echo $this->get_field_name('ref_url3'); ?>" type="text" value="<?php echo esc_attr($ref_url3); ?>" /></label></p>
    						
    						<p><label for="<?php echo $this->get_field_id('image_url4'); ?>">Image URL 4: (125px * 125px):
                            <input class="widefat" id="<?php echo $this->get_field_id('image_url4'); ?>" name="<?php echo $this->get_field_name('image_url4'); ?>" type="text" value="<?php echo esc_attr($image_url4); ?>" /></label></p>
     
                            <p><label for="<?php echo $this->get_field_id('ref_url4'); ?>">Referal URL 4:
                            <input class="widefat" id="<?php echo $this->get_field_id('ref_url4'); ?>" name="<?php echo $this->get_field_name('ref_url4'); ?>" type="text" value="<?php echo esc_attr($ref_url4); ?>" /></label></p>
     
                            <?php }?>
     
            <?php
                    }
            }
    }
     
     
     
    if (!class_exists('avia_one_partner_widget'))
    {
            //one image
            class avia_one_partner_widget extends avia_partner_widget
            {
                    function avia_one_partner_widget()
                    {
     
                            $this->add_cont = 1;
     
                            $widget_ops = array('classname' => 'avia_one_partner_widget', 'description' => 'An advertising widget that displays 1 big image' );
     
                            $this->WP_Widget( 'avia_one_partner_widget', THEMENAME.' Big Advertising Area', $widget_ops );
                    }
            }
    }
    
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Advertising area widget – is it possible to display 3 or more pictures’ is closed to new replies.