diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php
index 015795a33b..fe68fa7293 100644
--- a/wp-admin/edit-pages.php
+++ b/wp-admin/edit-pages.php
@@ -122,6 +122,9 @@ endif;
+get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+ if ($comments) {
+ // Make sure comments, post, and post_author are cached
+ update_comment_cache($comments);
+ $post = get_post($id);
+ $authordata = get_userdata($post->post_author);
+ ?>
+
+';
+ } // end if comments
+?>
+
+
diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php
index 2301ee1a88..e138a5e6fe 100644
--- a/wp-includes/widgets.php
+++ b/wp-includes/widgets.php
@@ -647,12 +647,7 @@ function wp_widget_text_register() {
$control_ops = array('width' => 460, 'height' => 350, 'id_base' => 'text');
$name = __('Text');
- // If there are none, we register the widget's existance with a generic template
- if ( !$options ) {
- wp_register_sidebar_widget( 'text-1', $name, 'wp_widget_text', $widget_ops, array( 'number' => -1 ) );
- wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) );
- }
-
+ $id = false;
foreach ( array_keys($options) as $o ) {
// Old widgets can have null values for some reason
if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) )
@@ -661,6 +656,12 @@ function wp_widget_text_register() {
wp_register_sidebar_widget($id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ));
wp_register_widget_control($id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ));
}
+
+ // If there are none, we register the widget's existance with a generic template
+ if ( !$id ) {
+ wp_register_sidebar_widget( 'text-1', $name, 'wp_widget_text', $widget_ops, array( 'number' => -1 ) );
+ wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) );
+ }
}
// See large comment section at end of this file
@@ -808,12 +809,7 @@ function wp_widget_categories_register() {
$name = __( 'Categories' );
- // If there are none, we register the widget's existance with a generic template
- if ( !$options ) {
- wp_register_sidebar_widget( 'categories-1', $name, 'wp_widget_categories', $widget_ops, array( 'number' => -1 ) );
- wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) );
- }
-
+ $id = false;
foreach ( array_keys($options) as $o ) {
// Old widgets can have null values for some reason
if ( !isset($options[$o]['title']) )
@@ -823,6 +819,11 @@ function wp_widget_categories_register() {
wp_register_widget_control( $id, $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => $o ) );
}
+ // If there are none, we register the widget's existance with a generic template
+ if ( !$id ) {
+ wp_register_sidebar_widget( 'categories-1', $name, 'wp_widget_categories', $widget_ops, array( 'number' => -1 ) );
+ wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) );
+ }
}
function wp_widget_categories_upgrade() {
@@ -1297,12 +1298,7 @@ function wp_widget_rss_register() {
$control_ops = array('width' => 410, 'height' => 200, 'id_base' => 'rss');
$name = __('RSS');
- // If there are none, we register the widget's existance with a generic template
- if ( !$options ) {
- wp_register_sidebar_widget( 'rss-1', $name, 'wp_widget_rss', $widget_ops, array( 'number' => -1 ) );
- wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) );
- }
-
+ $id = false;
foreach ( array_keys($options) as $o ) {
// Old widgets can have null values for some reason
if ( !isset($options[$o]['url']) || !isset($options[$o]['title']) || !isset($options[$o]['items']) )
@@ -1311,6 +1307,12 @@ function wp_widget_rss_register() {
wp_register_sidebar_widget($id, $name, 'wp_widget_rss', $widget_ops, array( 'number' => $o ));
wp_register_widget_control($id, $name, 'wp_widget_rss_control', $control_ops, array( 'number' => $o ));
}
+
+ // If there are none, we register the widget's existance with a generic template
+ if ( !$id ) {
+ wp_register_sidebar_widget( 'rss-1', $name, 'wp_widget_rss', $widget_ops, array( 'number' => -1 ) );
+ wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) );
+ }
}
function wp_widget_tag_cloud($args) {
@@ -1489,12 +1491,7 @@ function widget_many_register() {
$control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'many');
$name = __('Many');
- // If there are none, we register the widget's existance with a generic template
- if ( !$options ) {
- wp_register_sidebar_widget( 'many-1', $name, 'widget_many', $widget_ops, array( 'number' => -1 ) );
- wp_register_widget_control( 'many-1', $name, 'widget_many_control', $control_ops, array( 'number' => -1 ) );
- }
-
+ $registered = false;
foreach ( array_keys($options) as $o ) {
// Old widgets can have null values for some reason
if ( !isset($options[$o]['something']) ) // we used 'something' above in our exampple. Replace with with whatever your real data are.
@@ -1502,9 +1499,16 @@ function widget_many_register() {
// $id should look like {$id_base}-{$o}
$id = "many-$o"; // Never never never translate an id
+ $registered = true;
wp_register_sidebar_widget( $id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ) );
wp_register_widget_control( $id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ) );
}
+
+ // If there are none, we register the widget's existance with a generic template
+ if ( !$registered ) {
+ wp_register_sidebar_widget( 'many-1', $name, 'widget_many', $widget_ops, array( 'number' => -1 ) );
+ wp_register_widget_control( 'many-1', $name, 'widget_many_control', $control_ops, array( 'number' => -1 ) );
+ }
}
// This is important