WP_Widget_Pages::form() public WP 2.8.0
Outputs the settings form for the Pages widget.
{} Это метод класса: WP_Widget_Pages{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WP_Widget_Pages = new WP_Widget_Pages(); $WP_Widget_Pages->form( $instance );
- $instance(массив) (обязательный)
- Current settings.
Список изменений
С версии 2.8.0 | Введена. |
Код WP_Widget_Pages::form() WP Widget Pages::form WP 5.6.2
public function form( $instance ) {
// Defaults.
$instance = wp_parse_args(
(array) $instance,
array(
'sortby' => 'post_title',
'title' => '',
'exclude' => '',
)
);
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>"><?php _e( 'Sort by:' ); ?></label>
<select name="<?php echo esc_attr( $this->get_field_name( 'sortby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>" class="widefat">
<option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title' ); ?></option>
<option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order' ); ?></option>
<option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>"><?php _e( 'Exclude:' ); ?></label>
<input type="text" value="<?php echo esc_attr( $instance['exclude'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'exclude' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>" class="widefat" />
<br />
<small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
</p>
<?php
}