Changeset 42343 for trunk/src/wp-includes/widgets/class-wp-widget-pages.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-pages.php
r41867 r42343 24 24 public function __construct() { 25 25 $widget_ops = array( 26 'classname' => 'widget_pages',27 'description' => __( 'A list of your site’s Pages.' ),26 'classname' => 'widget_pages', 27 'description' => __( 'A list of your site’s Pages.' ), 28 28 'customize_selective_refresh' => true, 29 29 ); … … 54 54 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 55 55 56 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];56 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; 57 57 $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; 58 58 59 if ( $sortby == 'menu_order' ) 59 if ( $sortby == 'menu_order' ) { 60 60 $sortby = 'menu_order, post_title'; 61 } 61 62 62 63 /** … … 71 72 * @param array $instance Array of settings for the current widget. 72 73 */ 73 $out = wp_list_pages( apply_filters( 'widget_pages_args', array( 74 'title_li' => '', 75 'echo' => 0, 76 'sort_column' => $sortby, 77 'exclude' => $exclude 78 ), $instance ) ); 74 $out = wp_list_pages( 75 apply_filters( 76 'widget_pages_args', array( 77 'title_li' => '', 78 'echo' => 0, 79 'sort_column' => $sortby, 80 'exclude' => $exclude, 81 ), $instance 82 ) 83 ); 79 84 80 85 if ( ! empty( $out ) ) { … … 103 108 */ 104 109 public function update( $new_instance, $old_instance ) { 105 $instance = $old_instance;110 $instance = $old_instance; 106 111 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 107 112 if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) { … … 125 130 public function form( $instance ) { 126 131 //Defaults 127 $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') ); 132 $instance = wp_parse_args( 133 (array) $instance, array( 134 'sortby' => 'post_title', 135 'title' => '', 136 'exclude' => '', 137 ) 138 ); 128 139 ?> 129 140 <p> 130 141 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label> 131 <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'] ); ?>" />142 <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'] ); ?>" /> 132 143 </p> 133 144 <p> 134 145 <label for="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>"><?php _e( 'Sort by:' ); ?></label> 135 146 <select name="<?php echo esc_attr( $this->get_field_name( 'sortby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>" class="widefat"> 136 <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title'); ?></option>137 <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order'); ?></option>147 <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title' ); ?></option> 148 <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order' ); ?></option> 138 149 <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option> 139 150 </select>
Note: See TracChangeset
for help on using the changeset viewer.