示例#1
0
    /**
     * Displays the form for this widget on the Widgets page of the WP Admin area.
     *
     * @param array  An array of the current settings for this widget
     * @return void
     **/
    public function form($instance)
    {
        /* Set up some default widget settings. */
        $defaults = array('title' => '', 'image_id' => '', 'text' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        $image_id = esc_attr($instance['image_id']);
        ?>
        <p>
            <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('title');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        if (!empty($instance['title'])) {
            echo $instance['title'];
        }
        ?>
" />
        </p>
        
        <p>
            <label for=""><?php 
        _e('Image:', 'onepress');
        ?>
</label>
            <?php 
        $arg = array('field_name' => $this->get_field_name('image_id'), 'field_id' => $this->get_field_id('image_id'));
        onepress_widget_image_uploader($arg, $image_id);
        ?>
        </p>

        <p>
            <label for="<?php 
        echo $this->get_field_id('text');
        ?>
"><?php 
        _e('Widget Content:', 'onepress');
        ?>
</label><br />
            <textarea name="<?php 
        echo $this->get_field_name('text');
        ?>
" id="<?php 
        echo $this->get_field_id('text');
        ?>
" class="widefat" rows="10" cols="20"><?php 
        if (!empty($instance['text'])) {
            echo $instance['text'];
        }
        ?>
</textarea>
        </p>
       
    <?php 
    }
    /**
     * Displays the form for this widget on the Widgets page of the WP Admin area.
     *
     * @param array  An array of the current settings for this widget
     * @return void
     **/
    public function form($instance)
    {
        /* Set up some default widget settings. */
        $defaults = array('title' => 'George Wells', 'profile_image_id' => '', 'position' => 'User Experience', 'profile_twitter' => '', 'profile_facebok' => '', 'profile_google' => '', 'profile_linkedin' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        $profile_image_id = esc_attr($instance['profile_image_id']);
        ?>
        <p>
            <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Name:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('title');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        if (!empty($instance['title'])) {
            echo $instance['title'];
        }
        ?>
" />
        </p>

        <p>
            <label for=""><?php 
        _e('Profile Image:', 'onepress');
        ?>
</label>
            <?php 
        $arg = array('field_name' => $this->get_field_name('profile_image_id'), 'field_id' => $this->get_field_id('profile_image_id'));
        onepress_widget_image_uploader($arg, $profile_image_id);
        ?>
        </p>
        
        <p>
            <label for="<?php 
        echo $this->get_field_id('position');
        ?>
"><?php 
        _e('Position:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('position');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('position');
        ?>
" value="<?php 
        if (!empty($instance['position'])) {
            echo $instance['position'];
        }
        ?>
" />
        </p>
        
        <hr>

        <p>
            <label for="<?php 
        echo $this->get_field_id('profile_twitter');
        ?>
"><?php 
        _e('Twitter URL:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('profile_twitter');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('profile_twitter');
        ?>
" value="<?php 
        if (!empty($instance['profile_twitter'])) {
            echo $instance['profile_twitter'];
        }
        ?>
" />
        </p>
        

        <p>
            <label for="<?php 
        echo $this->get_field_id('profile_facebok');
        ?>
"><?php 
        _e('Facebook URL:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('profile_facebok');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('profile_facebok');
        ?>
" value="<?php 
        if (!empty($instance['profile_facebok'])) {
            echo $instance['profile_facebok'];
        }
        ?>
" />
        </p>
        
        <p>
            <label for="<?php 
        echo $this->get_field_id('profile_google');
        ?>
"><?php 
        _e('Google URL:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('profile_google');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('profile_google');
        ?>
" value="<?php 
        if (!empty($instance['profile_google'])) {
            echo $instance['profile_google'];
        }
        ?>
" />
        </p>

        <p>
            <label for="<?php 
        echo $this->get_field_id('profile_linkedin');
        ?>
"><?php 
        _e('Linkedin URL:', 'onepress');
        ?>
</label>
            <input id="<?php 
        echo $this->get_field_id('profile_linkedin');
        ?>
" class="widefat" type="text"  name="<?php 
        echo $this->get_field_name('profile_linkedin');
        ?>
" value="<?php 
        if (!empty($instance['profile_linkedin'])) {
            echo $instance['profile_linkedin'];
        }
        ?>
" />
        </p>
       
    <?php 
    }