WordPress.org

Make WordPress Core

Changeset 5605


Ignore:
Timestamp:
05/31/07 01:57:10 (7 years ago)
Author:
rob1n
Message:

Add option to exclude pages to pages widget. see #4259

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/wp-includes/widgets.php

    r5535 r5605  
    333333    $title = empty( $options['title'] ) ? __( 'Pages' ) : $options['title']; 
    334334    $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby']; 
     335    $exclude = empty( $options['exclude'] ) ? '' : '&exclude=' . $options['exclude']; 
    335336     
    336337    if ( $sortby == 'menu_order' ) { 
     
    338339    } 
    339340     
    340     $out = wp_list_pages( 'title_li=&echo=0&sort_column=' . $sortby ); 
     341    $out = wp_list_pages( 'title_li=&echo=0&sort_column=' . $sortby . $exclude ); 
    341342     
    342343    if ( !empty( $out ) ) { 
     
    364365            $newoptions['sortby'] = 'menu_order'; 
    365366        } 
     367         
     368        $newoptions['exclude'] = strip_tags( stripslashes( $_POST['pages-exclude'] ) ); 
    366369    } 
    367370    if ( $options != $newoptions ) { 
     
    370373    } 
    371374    $title = attribute_escape($options['title']); 
     375    $exclude = attribute_escape( $options['exclude'] ); 
    372376?> 
    373377            <p><label for="pages-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="pages-title" name="pages-title" type="text" value="<?php echo $title; ?>" /></label></p> 
     
    378382                    <option value="ID"<?php selected( $options['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option> 
    379383                </select></label></p> 
     384            <p><label for="pages-exclude"><?php _e( 'Exclude:' ); ?> <input type="text" value="<?php echo $exclude; ?>" name="pages-exclude" id="pages-exclude" style="width: 180px;" /></label><br /> 
     385            <small><?php _e( 'Page IDs, separated by commas.' ); ?></small></p> 
    380386            <input type="hidden" id="pages-submit" name="pages-submit" value="1" /> 
    381387<?php 
     
    957963    $class = array('classname' => 'widget_pages'); 
    958964    wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $class); 
    959     wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims90); 
     965    wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims150); 
    960966    $class['classname'] = 'widget_calendar'; 
    961967    wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $class); 
  • trunk/wp-includes/widgets.php

    r5535 r5605  
    333333    $title = empty( $options['title'] ) ? __( 'Pages' ) : $options['title']; 
    334334    $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby']; 
     335    $exclude = empty( $options['exclude'] ) ? '' : '&exclude=' . $options['exclude']; 
    335336     
    336337    if ( $sortby == 'menu_order' ) { 
     
    338339    } 
    339340     
    340     $out = wp_list_pages( 'title_li=&echo=0&sort_column=' . $sortby ); 
     341    $out = wp_list_pages( 'title_li=&echo=0&sort_column=' . $sortby . $exclude ); 
    341342     
    342343    if ( !empty( $out ) ) { 
     
    364365            $newoptions['sortby'] = 'menu_order'; 
    365366        } 
     367         
     368        $newoptions['exclude'] = strip_tags( stripslashes( $_POST['pages-exclude'] ) ); 
    366369    } 
    367370    if ( $options != $newoptions ) { 
     
    370373    } 
    371374    $title = attribute_escape($options['title']); 
     375    $exclude = attribute_escape( $options['exclude'] ); 
    372376?> 
    373377            <p><label for="pages-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="pages-title" name="pages-title" type="text" value="<?php echo $title; ?>" /></label></p> 
     
    378382                    <option value="ID"<?php selected( $options['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option> 
    379383                </select></label></p> 
     384            <p><label for="pages-exclude"><?php _e( 'Exclude:' ); ?> <input type="text" value="<?php echo $exclude; ?>" name="pages-exclude" id="pages-exclude" style="width: 180px;" /></label><br /> 
     385            <small><?php _e( 'Page IDs, separated by commas.' ); ?></small></p> 
    380386            <input type="hidden" id="pages-submit" name="pages-submit" value="1" /> 
    381387<?php 
     
    957963    $class = array('classname' => 'widget_pages'); 
    958964    wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $class); 
    959     wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims90); 
     965    wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims150); 
    960966    $class['classname'] = 'widget_calendar'; 
    961967    wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $class); 
Note: See TracChangeset for help on using the changeset viewer.