Ticket #2515: front_page.4b.diff

File front_page.4b.diff, 1.7 KB (added by ryanscheuermann, 6 years ago)

Rework last patch to use show_option_none

  • wp-admin/options-reading.php

     
    3030        </label> 
    3131<ul> 
    3232        <li><?php printf(__('Show this page on the front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&selected=" . get_option('page_on_front'))); ?></li> 
    33         <li><?php printf(__('Show the latest posts on this page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&selected=" . get_option('page_for_posts'))); ?></li> 
     33        <li><?php printf(__('Show the latest posts on this page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li> 
    3434</ul> 
    3535<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?> 
    3636<div id="front-page-warning" class="updated fade-ff0000"> 
  • wp-includes/template-functions-post.php

     
    383383                parse_str($args, $r); 
    384384 
    385385        $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 
    386                 'name' => 'page_id'); 
     386                'name' => 'page_id', 'show_option_none' => ''); 
    387387        $r = array_merge($defaults, $r); 
    388388        extract($r); 
    389389 
     
    392392 
    393393        if ( ! empty($pages) ) { 
    394394                $output = "<select name='$name'>\n"; 
     395                if($show_option_none) 
     396                                $output .= "\t<option value=''>$show_option_none</option>\n"; 
    395397                $output .= walk_page_dropdown_tree($pages, $depth, $r); 
    396398                $output .= "</select>\n"; 
    397399        }