| 1 | ################ |
|---|
| 2 | Patch to manage "menu titles" with WP Pages |
|---|
| 3 | |
|---|
| 4 | Author: Giovanni Allegri |
|---|
| 5 | Mail: giohappy@gmail.com |
|---|
| 6 | Date: 22 Octobe 2007 |
|---|
| 7 | Worpress version: 2.3 |
|---|
| 8 | ################ |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | Usage: |
|---|
| 12 | |
|---|
| 13 | Modifying the following files you can set a menu voice different from the Page title, from inside the Page Administration tools. |
|---|
| 14 | A "title_menu" new variable has been used, to manage the related "Walker" class functions. |
|---|
| 15 | You can use it within "wp_list_pages" function inside "The Loop". |
|---|
| 16 | |
|---|
| 17 | Example: |
|---|
| 18 | wp_list_pages('depth=1&title_li=&title_menu=true'); |
|---|
| 19 | |
|---|
| 20 | The default value is "false". |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | Modified files: |
|---|
| 26 | |
|---|
| 27 | ----- |
|---|
| 28 | FILE: wp-admin/includes/schema.php |
|---|
| 29 | |
|---|
| 30 | OLD: |
|---|
| 31 | #100 post_title text NOT NULL, |
|---|
| 32 | #101 post_category int(4) NOT NULL default '0', |
|---|
| 33 | |
|---|
| 34 | NEW: |
|---|
| 35 | #100 post_title text NOT NULL, |
|---|
| 36 | #101 post_title_menu text NOT NULL, |
|---|
| 37 | #102 post_category int(4) NOT NULL default '0', |
|---|
| 38 | |
|---|
| 39 | ----- |
|---|
| 40 | FILE: wp-includes/classes.php |
|---|
| 41 | |
|---|
| 42 | OLD: |
|---|
| 43 | #522 $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a>'; |
|---|
| 44 | |
|---|
| 45 | NEW: |
|---|
| 46 | #521 $voice=(($title_menu=='true')?$page->post_title_menu:$page->post_title); |
|---|
| 47 | #522 $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $voice) . '</a>'; |
|---|
| 48 | |
|---|
| 49 | ----- |
|---|
| 50 | FILE wp-includes/post-template.php |
|---|
| 51 | |
|---|
| 52 | OLD: |
|---|
| 53 | #312 'authors' => '', 'sort_column' => 'menu_order, post_title' |
|---|
| 54 | |
|---|
| 55 | NEW: |
|---|
| 56 | #312 'authors' => '', 'sort_column' => 'menu_order, post_title', 'title_menu' => 'false' |
|---|
| 57 | |
|---|
| 58 | ----- |
|---|
| 59 | FILE wp-includes/post.php |
|---|
| 60 | |
|---|
| 61 | OLD: |
|---|
| 62 | #718 post_title = '$post_title', |
|---|
| 63 | #719 post_excerpt = '$post_excerpt', |
|---|
| 64 | |
|---|
| 65 | NEW: |
|---|
| 66 | #718 post_title = '$post_title', |
|---|
| 67 | #719 post_title_menu = '$post_title_menu', |
|---|
| 68 | #720 post_excerpt = '$post_excerpt', |
|---|
| 69 | |
|---|
| 70 | OLD: |
|---|
| 71 | #736 "INSERT IGNORE INTO $wpdb->posts |
|---|
| 72 | #737 (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) |
|---|
| 73 | #738 VALUES |
|---|
| 74 | #738 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); |
|---|
| 75 | |
|---|
| 76 | NEW: |
|---|
| 77 | #736 "INSERT IGNORE INTO $wpdb->posts |
|---|
| 78 | #737 (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_title_menu, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) |
|---|
| 79 | #738 VALUES |
|---|
| 80 | #738 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_title_menu', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); |
|---|
| 81 | |
|---|
| 82 | THE SAME LAST TWO SUBSTITUTION HAS BEEN APPLIED ALSO AT ROWS 1372-1373 AND 1392-1396 |
|---|
| 83 | |
|---|
| 84 | ----- |
|---|
| 85 | FILE wp-admin/edit-page-form.php |
|---|
| 86 | |
|---|
| 87 | OLD: |
|---|
| 88 | #134 <fieldset id="titlediv"> |
|---|
| 89 | #135 <legend><?php _e('Page Title') ?></legend> |
|---|
| 90 | #136 <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div> |
|---|
| 91 | #137 </fieldset> |
|---|
| 92 | #138 |
|---|
| 93 | #139 |
|---|
| 94 | #140<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> |
|---|
| 95 | |
|---|
| 96 | NEW: |
|---|
| 97 | #134 <fieldset id="titlediv"> |
|---|
| 98 | #135 <legend><?php _e('Page Title') ?></legend> |
|---|
| 99 | #136 <div><input type="text" name="post_title" size="30" tabindex="0" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div> |
|---|
| 100 | #137 </fieldset> |
|---|
| 101 | #138 |
|---|
| 102 | #139 <fieldset id="titlediv"> |
|---|
| 103 | #140 <legend><?php _e('Page Title Menu') ?></legend> |
|---|
| 104 | #141 <div><input type="text" name="post_title_menu" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title_menu ); ?>" id="post_title_menu" /></div> |
|---|
| 105 | #142 </fieldset> |
|---|
| 106 | #143 |
|---|
| 107 | #144 |
|---|
| 108 | #145 <fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | The End. |
|---|