WordPress.org

Make WordPress Core

Ticket #5244: Patch menu titles.txt

File Patch menu titles.txt, 4.4 KB (added by giohappy, 8 years ago)

changes to the code

Line 
1################
2Patch to manage "menu titles" with WP Pages
3
4Author: Giovanni Allegri
5Mail: giohappy@gmail.com
6Date: 22 Octobe 2007
7Worpress version: 2.3
8################
9
10
11Usage:
12
13Modifying the following files you can set a menu voice different from the Page title, from inside the Page Administration tools.
14A "title_menu" new variable has been used, to manage the related "Walker" class functions.
15You can use it within "wp_list_pages" function inside "The Loop".
16
17Example:
18wp_list_pages('depth=1&title_li=&title_menu=true');
19
20The default value is "false".
21
22
23
24
25Modified files:
26
27-----
28FILE: wp-admin/includes/schema.php
29
30OLD:
31#100 post_title text NOT NULL,
32#101 post_category int(4) NOT NULL default '0',
33
34NEW:
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-----
40FILE: wp-includes/classes.php
41
42OLD:
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
45NEW:
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-----
50FILE wp-includes/post-template.php
51
52OLD:
53#312 'authors' => '', 'sort_column' => 'menu_order, post_title'
54
55NEW:
56#312 'authors' => '', 'sort_column' => 'menu_order, post_title', 'title_menu' => 'false'
57
58-----
59FILE wp-includes/post.php
60
61OLD:
62#718 post_title = '$post_title',
63#719 post_excerpt = '$post_excerpt',
64
65NEW:
66#718 post_title = '$post_title',
67#719 post_title_menu = '$post_title_menu',
68#720 post_excerpt = '$post_excerpt',
69
70OLD:
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
76NEW:
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
82THE SAME LAST TWO SUBSTITUTION HAS BEEN APPLIED ALSO AT ROWS 1372-1373 AND 1392-1396
83
84-----
85FILE wp-admin/edit-page-form.php
86
87OLD:
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
96NEW:
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
111The End.