Results 1 to 2 of 2

Thread: Widget Function not working correctly

  1. #1
    Thread Starter
    Veteran demonlee's Avatar
    Join Date
    Mar 2011
    Location
    Antas, Spain
    Posts
    574
    Thanks
    6
    Thanked 51 Times in 46 Posts

    Widget Function not working correctly

    On the 125x125 Widget, when linking it to adverts, it is NOT opening in a new window, however the code from the widgets page (see below) appears to require that as part of the widget... anyone got an answer?

    PHP Code:
    // custom sidebar 125x125 ads widget
    class AppThemes_Widget_125_Ads extends WP_Widget {

        function AppThemes_Widget_125_Ads() {
            $widget_ops = array( 'description' => __( 'Places an ad space in the sidebar for 125x125 ads', APP_TD ) );
            $control_ops = array('width' => 500, 'height' => 350);
            $this->WP_Widget( 'cp_125_ads', __( 'CP 125x125 Ads', APP_TD ), $widget_ops, $control_ops );
        }

        function widget( $args, $instance ) {

            extract($args);

            $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Sponsored Ads', APP_TD ) : $instance['title'] );
            $newin = isset( $instance['newin'] ) ? $instance['newin'] : false;


            if (isset($instance['ads'])) :

                // separate the ad line items into an array
                $ads = explode("\n", $instance['ads']);

                if (sizeof($ads)>0) :

                    echo $before_widget;

                    if ($title) echo $before_title . $title . $after_title;
                    [B][U]if ($newin) $newin = 'target="_blank"';[/U][/B]
                ?>

                    <ul class="ads">
                <?php
                    $alt 
    1;
                    foreach (
    $ads as $ad) :
                        if (
    $ad && strstr($ad'|')) {
                            
    $alt $alt*-1;
                            
    $this_ad explode('|'$ad);
                            echo 
    '<li class="';
                            if (
    $alt==1) echo 'alt';
                            echo 
    '"><a href="'.$this_ad[0].'" rel="'.$this_ad[3].'" '.$newin.'><img src="'.$this_ad[1].'" width="125" height="125" alt="'.$this_ad[2].'" /></a></li>';
                        }
                    endforeach;
                
    ?>
                    </ul>

                    <?php
                    
    echo $after_widget;

                endif;

            endif;
        }
    Demon- I shoot People
    www.demonlee.com Photography Website
    www.seemeadvert.co.uk Classipress Website
    www.imdb.me.com/demonlee Film

  2. #2
    Thread Starter
    Veteran demonlee's Avatar
    Join Date
    Mar 2011
    Location
    Antas, Spain
    Posts
    574
    Thanks
    6
    Thanked 51 Times in 46 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Demon- I shoot People
    www.demonlee.com Photography Website
    www.seemeadvert.co.uk Classipress Website
    www.imdb.me.com/demonlee Film

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Tag cloud widget not showing correctly
    By johnny99 in forum JobRoller General Discussion
    Replies: 6
    Last Post: September 27th, 2013, 10:11 AM
  2. [SOLVED] Blog Page not working correctly
    By jtanner1990 in forum Help Using Vantage (Legacy)
    Replies: 6
    Last Post: June 17th, 2013, 06:14 PM
  3. [SOLVED] Join Now! button on the landing page it does not function correctly.
    By webcraftws in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: June 16th, 2012, 03:55 PM
  4. Indeed not working correctly
    By baxter in forum Report JobRoller Bugs
    Replies: 3
    Last Post: February 6th, 2012, 05:58 AM