Changeset 7077

Show
Ignore:
Timestamp:
02/27/08 23:57:00 (9 months ago)
Author:
ryan
Message:

fix new-fangled multi widgets. Props mdawaffe. see #6022

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-pages.php

    r7057 r7077  
    123123<?php 
    124124$query_str = "post_type=page&orderby=menu_order title&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc"; 
     125if ( !empty($_GET['p']) ) { 
     126    $query_str .= "p= 
     127} 
    125128$query_str = apply_filters('manage_pages_query', $query_str); 
    126129wp($query_str); 
     
    161164</div> 
    162165 
     166<?php 
     167if ( 1 == count($posts) && isset( $_GET['p'] ) ) { 
     168 
     169    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); 
     170    if ($comments) { 
     171        // Make sure comments, post, and post_author are cached 
     172        update_comment_cache($comments); 
     173        $post = get_post($id); 
     174        $authordata = get_userdata($post->post_author); 
     175    ?> 
     176<h3 id="comments"><?php _e('Comments') ?></h3> 
     177<ol id="the-comment-list" class="list:comment commentlist"> 
     178<?php 
     179        $i = 0; 
     180        foreach ( $comments as $comment ) { 
     181            _wp_comment_list_item( $comment->comment_ID, ++$i ); 
     182        } 
     183    echo '</ol>'; 
     184    } // end if comments 
     185?> 
     186<?php } ?> 
     187 
    163188</div> 
    164189 
  • trunk/wp-includes/widgets.php

    r6983 r7077  
    648648    $name = __('Text'); 
    649649 
    650     // If there are none, we register the widget's existance with a generic template 
    651     if ( !$options ) { 
    652         wp_register_sidebar_widget( 'text-1', $name, 'wp_widget_text', $widget_ops, array( 'number' => -1 ) ); 
    653         wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) ); 
    654     } 
    655  
     650    $id = false; 
    656651    foreach ( array_keys($options) as $o ) { 
    657652        // Old widgets can have null values for some reason 
     
    661656        wp_register_sidebar_widget($id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o )); 
    662657        wp_register_widget_control($id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o )); 
     658    } 
     659 
     660    // If there are none, we register the widget's existance with a generic template 
     661    if ( !$id ) { 
     662        wp_register_sidebar_widget( 'text-1', $name, 'wp_widget_text', $widget_ops, array( 'number' => -1 ) ); 
     663        wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) ); 
    663664    } 
    664665} 
     
    809810    $name = __( 'Categories' ); 
    810811 
    811     // If there are none, we register the widget's existance with a generic template 
    812     if ( !$options ) { 
    813         wp_register_sidebar_widget( 'categories-1', $name, 'wp_widget_categories', $widget_ops, array( 'number' => -1 ) ); 
    814         wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) ); 
    815     } 
    816  
     812    $id = false; 
    817813    foreach ( array_keys($options) as $o ) { 
    818814        // Old widgets can have null values for some reason 
     
    824820    } 
    825821 
     822    // If there are none, we register the widget's existance with a generic template 
     823    if ( !$id ) { 
     824        wp_register_sidebar_widget( 'categories-1', $name, 'wp_widget_categories', $widget_ops, array( 'number' => -1 ) ); 
     825        wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) ); 
     826    } 
    826827} 
    827828 
     
    12981299    $name = __('RSS'); 
    12991300 
    1300     // If there are none, we register the widget's existance with a generic template 
    1301     if ( !$options ) { 
    1302         wp_register_sidebar_widget( 'rss-1', $name, 'wp_widget_rss', $widget_ops, array( 'number' => -1 ) ); 
    1303         wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) ); 
    1304     } 
    1305  
     1301    $id = false; 
    13061302    foreach ( array_keys($options) as $o ) { 
    13071303        // Old widgets can have null values for some reason 
     
    13111307        wp_register_sidebar_widget($id, $name, 'wp_widget_rss', $widget_ops, array( 'number' => $o )); 
    13121308        wp_register_widget_control($id, $name, 'wp_widget_rss_control', $control_ops, array( 'number' => $o )); 
     1309    } 
     1310 
     1311    // If there are none, we register the widget's existance with a generic template 
     1312    if ( !$id ) { 
     1313        wp_register_sidebar_widget( 'rss-1', $name, 'wp_widget_rss', $widget_ops, array( 'number' => -1 ) ); 
     1314        wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) ); 
    13131315    } 
    13141316} 
     
    14901492    $name = __('Many'); 
    14911493 
    1492     // If there are none, we register the widget's existance with a generic template 
    1493     if ( !$options ) { 
    1494         wp_register_sidebar_widget( 'many-1', $name, 'widget_many', $widget_ops, array( 'number' => -1 ) ); 
    1495         wp_register_widget_control( 'many-1', $name, 'widget_many_control', $control_ops, array( 'number' => -1 ) ); 
    1496     } 
    1497  
     1494    $registered = false; 
    14981495    foreach ( array_keys($options) as $o ) { 
    14991496        // Old widgets can have null values for some reason 
     
    15031500        // $id should look like {$id_base}-{$o} 
    15041501        $id = "many-$o"; // Never never never translate an id 
     1502        $registered = true; 
    15051503        wp_register_sidebar_widget( $id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ) ); 
    15061504        wp_register_widget_control( $id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ) ); 
    15071505    } 
     1506 
     1507    // If there are none, we register the widget's existance with a generic template 
     1508    if ( !$registered ) { 
     1509        wp_register_sidebar_widget( 'many-1', $name, 'widget_many', $widget_ops, array( 'number' => -1 ) ); 
     1510        wp_register_widget_control( 'many-1', $name, 'widget_many_control', $control_ops, array( 'number' => -1 ) ); 
     1511    } 
    15081512} 
    15091513