hi ,
I am creating author info widget through 2.8 Widget API,
I need to enqueue a editor perhaps tinymce in that widget .
can anyone help me ..
i need a easy guide.. as am a new in wordpress widget.
thanks ajaxee,
hi ,
I am creating author info widget through 2.8 Widget API,
I need to enqueue a editor perhaps tinymce in that widget .
can anyone help me ..
i need a easy guide.. as am a new in wordpress widget.
thanks ajaxee,
my actally code is here , anyone plz tell me how ato add a tinymce editor into textarea field [text_about_me] ..
<?php
class AboutMeMultiWidget extends WP_Widget
{
function AboutMeMultiWidget()
{
$this->WP_Widget(
'aboutMe-multi', // id_base
'AboutMeMulti', // name
array('description'=>__('AboutMe Widget which allows multiple instances')),
array('width'=>700,'height'=>800)
);
}
// Echo the actual widget content. Subclasses should over-ride this function
// to generate their widget code.
function widget($args,$instance)
{
extract($args,EXTR_SKIP);
echo $before_widget;
?>
<h3><?php echo $instance['title']; ?></h3>
<?php
echo $before_title . $after_title;
echo '<div class="col-b">
<p>
<a href="' . $instance['gravatar_icon'] . '">
<img src="' . $instance['gravatar_icon'] . '" width="40" height="40" alt="about me" class="float-left" />
</a>
<p>' . $instance['text_about_me'] . '</p>
</div>
';
echo $after_widget;
}
// Update a particular instance.
// This function should check that $new_instance is set correctly.
// The newly calculated value of $instance should be returned.
function update($new_instance, $old_instance)
{
if( !isset($new_instance['title']) ) // user clicked cancel
return false;
$instance = $old_instance;
$instance['title'] = wp_specialchars( $new_instance['title'] );
$instance['text_about_me'] = wp_specialchars( $new_instance['text_about_me'] );
$instance['gravatar_icon'] = wp_specialchars( $new_instance['gravatar_icon'] );
return $instance;
}
// Echo a control form for the current instance.
// The form has inputs with names like widget-ID_BASE[$number][FIELD_NAME]
// so that all data for that instance of the widget are stored in one
// $_POST variable: $_POST['widget-ID_BASE'][$number]
function form($instance)
{
?>
<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 htmlspecialchars($instance['title'],ENT_QUOTES) ?>" />
</label>
<label for="<?php echo $this->get_field_id('text_about_me') ?>">
<?php _e('About Me:'); ?>
<textarea id="<?php echo $this->get_field_id('text_about_me') ?>"
name="<?php echo $this->get_field_name('text_about_me') ?>" style="width: 400px; height: 200px;">
<?php echo htmlspecialchars($instance['text_about_me'],ENT_QUOTES) ?>
</textarea>
</label>
<label for="<?php echo $this->get_field_id('gravatar_icon') ?>">
<?php _e('Gravtar Icon:'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('gravatar_icon') ?>"
name="<?php echo $this->get_field_name('gravatar_icon') ?>" type="text"
value="<?php echo htmlspecialchars($instance['gravatar_icon'],ENT_QUOTES) ?>" />
</label>
<input type="hidden" id="<?php echo $this->get_field_id('submit') ?>"
name="<?php echo $this->get_field_name('submit') ?>" value="1" />
</p>
<?php
}
} // end class AboutMeMultiWidget
register_widget('AboutMeMultiWidget');
?>/*my actual code */
This topic has been closed to new replies.