WordPress.org

Make WordPress Core

Ticket #17032: widget.diff

File widget.diff, 6.6 KB (added by rozani, 11 years ago)
Line 
1Index: trunk/wp-content/themes/twentyten/functions.php
2===================================================================
3--- a/trunk/wp-content/themes/twentyten/functions.php
4+++ b/trunk/wp-content/themes/twentyten/functions.php
5@@ -364,4 +364,82 @@
6- /**
7- * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
8- *
9- * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
10- * function tied to the init hook.
11- *
12- * @since Twenty Ten 1.0
13- * @uses register_sidebar
14- */
15- function twentyten_widgets_init() {
16        // Area 1, located at the top of the sidebar.
17        register_sidebar( array(
18                'name' => __( 'Primary Widget Area', 'twentyten' ),
19                'id' => 'primary-widget-area',
20                'description' => __( 'The primary widget area', 'twentyten' ),
21                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
22                'after_widget' => '</li>',
23                'before_title' => '<h3 class="widget-title">',
24                'after_title' => '</h3>',
25        ) );
26
27        // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
28        register_sidebar( array(
29                'name' => __( 'Secondary Widget Area', 'twentyten' ),
30                'id' => 'secondary-widget-area',
31                'description' => __( 'The secondary widget area', 'twentyten' ),
32                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
33                'after_widget' => '</li>',
34                'before_title' => '<h3 class="widget-title">',
35                'after_title' => '</h3>',
36        ) );
37
38-       // Area 3, located in the footer. Empty by default.
39        register_sidebar( array(
40                'name' => __( 'First Footer Widget Area', 'twentyten' ),
41                'id' => 'first-footer-widget-area',
42                'description' => __( 'The first footer widget area', 'twentyten' ),
43                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
44                'after_widget' => '</li>',
45                'before_title' => '<h3 class="widget-title">',
46                'after_title' => '</h3>',
47        ) );
48
49-       // Area 4, located in the footer. Empty by default.
50        register_sidebar( array(
51                'name' => __( 'Second Footer Widget Area', 'twentyten' ),
52                'id' => 'second-footer-widget-area',
53                'description' => __( 'The second footer widget area', 'twentyten' ),
54                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
55                'after_widget' => '</li>',
56                'before_title' => '<h3 class="widget-title">',
57                'after_title' => '</h3>',
58        ) );
59
60-       // Area 5, located in the footer. Empty by default.
61        register_sidebar( array(
62                'name' => __( 'Third Footer Widget Area', 'twentyten' ),
63                'id' => 'third-footer-widget-area',
64                'description' => __( 'The third footer widget area', 'twentyten' ),
65                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
66                'after_widget' => '</li>',
67                'before_title' => '<h3 class="widget-title">',
68                'after_title' => '</h3>',
69        ) );
70
71-       // Area 6, located in the footer. Empty by default.
72        register_sidebar( array(
73                'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
74                'id' => 'fourth-footer-widget-area',
75                'description' => __( 'The fourth footer widget area', 'twentyten' ),
76                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
77                'after_widget' => '</li>',
78                'before_title' => '<h3 class="widget-title">',
79                'after_title' => '</h3>',
80        ) );
81}
82-/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
83-add_action( 'widgets_init', 'twentyten_widgets_init' );
84
85+ /**
86+  * Register widgetized areas, including two sidebars.
87+  * @uses register_sidebar
88+  */
89+ function twentyten_sidebar_widgets_init() {
90        // Area 1, located at the top of the sidebar.
91        register_sidebar( array(
92                'name' => __( 'Primary Widget Area', 'twentyten' ),
93                'id' => 'primary-widget-area',
94                'description' => __( 'The primary widget area', 'twentyten' ),
95                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
96                'after_widget' => '</li>',
97                'before_title' => '<h3 class="widget-title">',
98                'after_title' => '</h3>',
99        ) );
100 
101        // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
102        register_sidebar( array(
103                'name' => __( 'Secondary Widget Area', 'twentyten' ),
104                'id' => 'secondary-widget-area',
105                'description' => __( 'The secondary widget area', 'twentyten' ),
106                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
107                'after_widget' => '</li>',
108                'before_title' => '<h3 class="widget-title">',
109                'after_title' => '</h3>',
110        ) );
111+ /** Register sidebars by running twentyten_sidebar_widgets_init() on the widgets_init hook. */
112+ add_action( 'widgets_init', 'twentyten_sidebar_widgets_init' );
113
114+ /**
115+  * Register widgetized areas, including four widget-ready columns in the footer.
116+  * @uses register_sidebar
117+  */   
118+ function twentyten_footer_widgets_init() {
119+       // Area 1, located in the footer. Empty by default.
120        register_sidebar( array(
121                'name' => __( 'First Footer Widget Area', 'twentyten' ),
122                'id' => 'first-footer-widget-area',
123                'description' => __( 'The first footer widget area', 'twentyten' ),
124                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
125                'after_widget' => '</li>',
126                'before_title' => '<h3 class="widget-title">',
127                'after_title' => '</h3>',
128        ) );
129 
130+       // Area 2, located in the footer. Empty by default.
131        register_sidebar( array(
132                'name' => __( 'Second Footer Widget Area', 'twentyten' ),
133                'id' => 'second-footer-widget-area',
134                'description' => __( 'The second footer widget area', 'twentyten' ),
135                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
136                'after_widget' => '</li>',
137                'before_title' => '<h3 class="widget-title">',
138                'after_title' => '</h3>',
139        ) );
140 
141+       // Area 3, located in the footer. Empty by default.
142        register_sidebar( array(
143                'name' => __( 'Third Footer Widget Area', 'twentyten' ),
144                'id' => 'third-footer-widget-area',
145                'description' => __( 'The third footer widget area', 'twentyten' ),
146                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
147                'after_widget' => '</li>',
148                'before_title' => '<h3 class="widget-title">',
149                'after_title' => '</h3>',
150        ) );
151 
152+       // Area 4, located in the footer. Empty by default.
153        register_sidebar( array(
154                'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
155                'id' => 'fourth-footer-widget-area',
156                'description' => __( 'The fourth footer widget area', 'twentyten' ),
157                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
158                'after_widget' => '</li>',
159                'before_title' => '<h3 class="widget-title">',
160                'after_title' => '</h3>',
161        ) );
162}
163+ /** Register sidebars by running twentyten_footer_widgets_init() on the widgets_init hook. */
164+ add_action( 'widgets_init', 'twentyten_footer_widgets_init' );