WP Search widget development as like as html template search box
Search widget development as like as html template search box
//widgets_init er vitore widget development korte hoy.
at first use it in widgets_init hook,
register_widget('comm_search'); //use for widget development
then,
widgets_init er baire
/*
*
* extends class for search widget development
*
*/
class comm_search extends WP_Widget{
public function __construct( ){
parent::__construct('comm_search', 'Commet Search Box', [
'description' =>'Commet Search Form'
] );
}
public function widget( $one, $two){ //output set korte hobe eikhane
$title = $two['title'];
?>
<?php echo $one['before_widget']; ?>
<?php echo $one['before_title']; ?><?php echo $title; ?><?php echo $one['after_title']; ?>
<form method="GET">
<input type="text" name="s" placeholder="Search.." class="form-control">
</form>
<?php echo $one['after_widget']; ?>
<?php }
public function form($two ){
$title = $two['title'];
?>
<p>
<label for="">Title</label>
<input name="<?php echo $this-> get_field_name('title');?>" value="<?php echo $title; ?>" class="widefat" type="text">
</p>
<?php }
}
..........................................
No comments