Вы можете создать свой собственный плагин и виджет для этого. Вы можете выводить форму и вводить теги в свой виджет.
В приведенном ниже примере вы можете вывести форму в функцию «виджет». Например, вы можете создать каталог в каталоге plugins и назвать его foo , затем создать php-файл с именем foo.php и использовать код, подобный следующему:
<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
/**
* Foo_Widget Class
*/
class Foo_Widget extends WP_Widget {
/** constructor */
function __construct() {
parent::WP_Widget( /* Base ID */'foo_widget', /* Name */'Foo_Widget', array( 'description' => 'A Foo Widget' ) );
}
/** @see WP_Widget::widget */
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title; ?>
<form action="" method="post">
<input type="text" name="mytext" />
<input type="text" name="result" value="<?php echo isset($_POST['mytext']) ? $_POST['mytext'] : ''; ?>" />
<input type="submit" name="submitbutton" value="Submit" /> </form>
<?php echo $after_widget;
}
/** @see WP_Widget::update */
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
/** @see WP_Widget::form */
function form( $instance ) {
if ( $instance ) {
$title = esc_attr( $instance[ 'title' ] );
}
else {
$title = __( 'New title', 'text_domain' );
}
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</p>
<?php
}
} // class Foo_Widget
// register Foo_Widget widget
add_action( 'widgets_init', create_function( '', 'register_widget("Foo_Widget");' ) );
?>