0

PHPログに次の未定義変数エラーが表示されますが、以下の関数で明確に定義されています。私は何か間違ったことをしていますか?

 [18-Sep-2013 15:17:23 UTC] PHP Notice:  Undefined variable: the_limit in /Volumes/Mac HD/Sites/thesite/wp-content/themes/site2.7/functions.php on line 313

 class EditorsPicks extends WP_Widget{
    function __construct()
    {
        $params=array(
            'description' => 'Editors Picks',
            'name'        => 'Editors Picks'            );

        parent::__construct('EditorsPicks','',$params);
    }

    public function form($instance)
    {
        extract($instance);

        // Title
        echo '<p><label for="'.$this->get_field_id('title').'">Title:</label>';
        echo '<input class="widefat" id="'.$this->get_field_id('title').'" name="'.$this->get_field_name('title').'"';
        echo 'value="';
        echo !empty($title) ? esc_attr($title) : 'Editor\'s Picks';
        echo '"/></p>';

        // Category
        echo '<p><label for="'.$this->get_field_id('category').'">Category ID:</label>';
        echo '<input class="widefat" type="number" id="'.$this->get_field_id('category').'" name="'.$this->get_field_name('category').'" value="';
        echo !empty($category) ? esc_attr($category) : 75646;
        echo '"/></p>';

        // Limit
        echo '<p><label for="'.$this->get_field_id('the_limit').'">Limit:</label>';
        echo '<input class="widefat" type="number" id="'.$this->get_field_id('the_limit').'" name="'.$this->get_field_name('the_limit').'" value="';
        echo !empty($the_limit) ? esc_attr($the_limit) : 5;
        echo '"/></p>';
    }

    function widget($args,$instance){
        extract($args);
        extract($instance);

        echo $before_widget;
        echo $before_title.$title.$after_title;

        global $post;
        $editors_picks=get_posts(array('cat'=>$category,'posts_per_page'=>$the_limit));

        echo '<ul class="editors_picks">';
        foreach($editors_picks as $post) : setup_postdata($post);
            $image = wp_get_attachment_image_src(get_post_thumbnail_id(),array(236,190));

            echo '<li class="clickable">';
            echo '<a rel="nofollow" href="'.get_permalink().'" title="'.get_the_title().'"><img width="100" height="81" src="'.$image[0].'" alt="'.get_the_title().'"/></a>';
            echo '<div class="title"><a href="'.get_permalink().'" title="'.get_the_title().'">'.textLimit(get_the_title(),80).'</a></div>';
            echo '</li>';
        endforeach;
        echo '</ul>';
        echo $after_widget;
    }
 }
4

1 に答える 1