Ticket #14325: 14325-patch2.diff
File 14325-patch2.diff, 5.3 KB (added by , 13 years ago) |
---|
-
wp-admin/css/wp-admin.dev.css
6667 6667 margin: 5px 0 1px; 6668 6668 } 6669 6669 6670 .nav-menus-php .major-publishing-actions .home-link-action { 6671 line-height: 23px; 6672 } 6673 6670 6674 .nav-menus-php .major-publishing-actions .delete-action { 6671 6675 vertical-align: middle; 6676 } 6677 6678 .nav-menus-php .major-publishing-actions .home-link-action, .nav-menus-php .major-publishing-actions .delete-action { 6672 6679 text-align: left; 6673 6680 float: left; 6674 6681 padding-right: 15px; -
wp-admin/includes/nav-menu.php
722 722 <?php 723 723 $args['walker'] = $walker; 724 724 725 // if we're dealing with pages, let's put a checkbox for the front page at the top of the list726 if ( 'page' == $post_type_name ) {727 $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;728 if ( ! empty( $front_page ) ) {729 $front_page_obj = get_post( $front_page );730 $front_page_obj->_add_to_top = true;731 $front_page_obj->label = sprintf( _x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title );732 array_unshift( $posts, $front_page_obj );733 } else {734 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;735 array_unshift( $posts, (object) array(736 '_add_to_top' => true,737 'ID' => 0,738 'object_id' => $_nav_menu_placeholder,739 'post_content' => '',740 'post_excerpt' => '',741 'post_parent' => '',742 'post_title' => _x('Home', 'nav menu home label'),743 'post_type' => 'nav_menu_item',744 'type' => 'custom',745 'url' => home_url('/'),746 ) );747 }748 }749 750 725 $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type ); 751 726 $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args ); 752 727 -
wp-admin/js/nav-menu.dev.js
39 39 this.attachThemeLocationsListeners(); 40 40 41 41 this.attachTabsPanelListeners(); 42 this.attachHomeLinkListener(); 42 43 43 44 this.attachUnsavedChangesListener(); 44 45 … … 554 555 } 555 556 }, processMethod, callback); 556 557 }, 558 559 addHomeLink : function() { 560 var url = $( '#home-link-url' ).val(); 561 var label = $( '#home-link-label' ).val(); 562 api.addLinkToMenu( url, label ); 563 }, 557 564 558 565 addItemToMenu : function(menuItem, processMethod, callback) { 559 566 var menu = $('#menu').val(), … … 611 618 registerChange : function() { 612 619 api.menusChanged = true; 613 620 }, 621 622 attachHomeLinkListener : function() { 623 $( '#add-home-link' ).bind( 'click', function( e ) { 624 api.registerChange(); 625 api.addHomeLink(); 626 return false; 627 } ); 628 }, 614 629 615 630 attachTabsPanelListeners : function() { 616 631 $('#menu-settings-column').bind('click', function(e) { -
wp-admin/nav-menus.php
564 564 <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?> 565 565 </div><!-- END .publishing-action --> 566 566 567 <?php if ( ! empty( $nav_menu_selected_id ) ) : ?> 567 <?php 568 569 // Add Home Link 570 if ( ! empty( $nav_menu_selected_id ) ) { 571 $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0; 572 if ( ! empty( $front_page ) ) { 573 $front_page_obj = get_post( $front_page ); 574 $home_link_label = sprintf( _x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title ); 575 $home_link_url = get_permalink( $front_page ); 576 } else { 577 $home_link_label = _x('Home', 'nav menu home label'); 578 $home_link_url = home_url('/'); 579 } 580 581 ?> 582 <div class="home-link-action"> 583 <input type="hidden" id="home-link-label" name="home_link_label" value="<?php echo $home_link_label; ?>" /> 584 <input type="hidden" id="home-link-url" name="home_link_url" value="<?php echo $home_link_url; ?>" /> 585 586 <?php submit_button( __( 'Add Home Link' ), 'button-secondary', 'add_home_link', false, array( 'id' => 'add-home-link' ) ); ?> 587 </div><!-- END .home-link-action --> 588 <?php } 589 590 if ( ! empty( $nav_menu_selected_id ) ) : ?> 591 568 592 <div class="delete-action"> 569 593 <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( admin_url('nav-menus.php?action=delete&menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ) ); ?>"><?php _e('Delete Menu'); ?></a> 570 594 </div><!-- END .delete-action --> 595 571 596 <?php endif; ?> 572 597 </div><!-- END .major-publishing-actions --> 573 598 </div><!-- END #submitpost .submitbox -->