[WordPress] Widget

new

 

edit pada functions.php

register_sidebar($foot);

function jawaipsum ( $atts )
{
echo ( is_home() ) ? ‘<li>Jawa Ipsum</li>’ : NULL;
}
add_shortcode( ‘jawaipsum’, ‘jawaipsum’ );

class Rweb_widget extends WP_Widget {
public function __construct()
{
parent::__construct ( ‘rweb’, ‘Rweb Widget’, array ( ‘description’ => ‘Ini simpel widget gaweanku.’) );
}
public function widget ( $args, $instance )
{
echo ‘<aside class=”widget”>’;
echo ‘<h3 class=”widget-title”>’.$instance[‘title’].'</h3>’;
echo ‘</aside>’;
}
public function form ( $instance )
{
echo ‘<p>’;
echo ‘<label>Title : </label>’;
echo ‘<input class=”widefat” type=”text” name=”‘.$this->get_field_name(‘title’).'” value=”‘.$instance[‘title’].'”>’;
echo ‘</p>’;
echo ‘<p></p>’;
}
public function update ( $new_instance, $old_instance )
{
$instance = array();
$instance[‘title’] = $new_instance[‘title’];
return $instance;
}
}
add_action ( ‘widgets_init’, create_function(”,’return register_widget(“Rweb_widget”);’));
?>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s