WordPress.org

Make WordPress Core

Ticket #4161: CatOrder_patch_20070418.txt

File CatOrder_patch_20070418.txt, 4.4 KB (added by Amarelo, 8 years ago)

Patch to write this functionality

Line 
1Index: wp-admin/admin-functions.php
2===================================================================
3--- wp-admin/admin-functions.php        (revisão 5282)
4+++ wp-admin/admin-functions.php        (cópia de trabalho)
5@@ -838,6 +838,7 @@
6                <th scope='row' style='text-align: center'>$category->cat_ID</th>
7                <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td>
8                <td>$category->category_description</td>
9+               <td align='center'>$category->cat_order</td>
10                <td align='center'>$posts_count</td>
11                <td align='center'>$category->link_count</td>
12                <td>$edit</td>\n\t</tr>\n";
13Index: wp-admin/admin-db.php
14===================================================================
15--- wp-admin/admin-db.php       (revisão 5282)
16+++ wp-admin/admin-db.php       (cópia de trabalho)
17@@ -129,10 +129,10 @@
18                $update = true;
19 
20        if (!$update) {
21-               $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private, type) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private', '$type')");
22+               $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private, type,cat_order) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private', '$type','$cat_order')");
23                $cat_ID = (int) $wpdb->insert_id;
24        } else {
25-               $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private', type = '$type' WHERE cat_ID = '$cat_ID'");
26+               $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private', type = '$type', cat_order = '$cat_order' WHERE cat_ID = '$cat_ID'");
27        }
28 
29        if ( $category_nicename == '' ) {
30Index: wp-admin/edit-category-form.php
31===================================================================
32--- wp-admin/edit-category-form.php     (revisão 5282)
33+++ wp-admin/edit-category-form.php     (cópia de trabalho)
34@@ -42,6 +42,10 @@
35                        <th scope="row" valign="top"><label for="category_description"><?php _e('Description: (optional)') ?></label></th>
36                        <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->category_description); ?></textarea></td>
37                </tr>
38+               <tr>
39+                       <th scope="row" valign="top"><label for="cat_order"><?php _e('Category Order: (optional)') ?></label></th>
40+                       <td><input name="cat_order" id="cat_order" value="<?php echo attribute_escape($category->cat_order); ?>" size="3"></td>
41+               </tr>
42        </table>
43 <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
44 <?php do_action('edit_category_form', $category); ?>
45Index: wp-admin/categories.php
46===================================================================
47--- wp-admin/categories.php     (revisão 5282)
48+++ wp-admin/categories.php     (cópia de trabalho)
49@@ -98,6 +98,7 @@
50                <th scope="col" style="text-align: center"><?php _e('ID') ?></th>
51         <th scope="col"><?php _e('Name') ?></th>
52         <th scope="col"><?php _e('Description') ?></th>
53+        <th scope="col" width="90" style="text-align: center"><?php _e('Order') ?></th>
54         <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
55         <th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
56         <th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
57Index: wp-admin/upgrade-schema.php
58===================================================================
59--- wp-admin/upgrade-schema.php (revisão 5282)
60+++ wp-admin/upgrade-schema.php (cópia de trabalho)
61@@ -13,6 +13,7 @@
62 $wp_queries="CREATE TABLE $wpdb->categories (
63   cat_ID bigint(20) NOT NULL auto_increment,
64   cat_name varchar(55) NOT NULL default '',
65+  cat_order tinyint(2) NULL default '0',
66   category_nicename varchar(200) NOT NULL default '',
67   category_description longtext NOT NULL,
68   category_parent bigint(20) NOT NULL default '0',