Make WordPress Core

Ticket #7749: 7749.diff

File 7749.diff, 3.2 KB (added by DD32, 16 years ago)
  • wp-includes/general-template.php

     
    740740        $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
    741741        $join = apply_filters('getarchives_join', "", $r);
    742742
     743        $output = '';
     744
    743745        if ( 'monthly' == $type ) {
    744746                $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
    745747                $key = md5($query);
     
    758760                                $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
    759761                                if ( $show_post_count )
    760762                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    761                                 $output = get_archives_link($url, $text, $format, $before, $after);
    762                                 if ( $echo )
    763                                         echo $output;
    764                                 else
    765                                         return $output;
     763                                $output .= get_archives_link($url, $text, $format, $before, $after);
    766764                        }
    767765                }
    768766        } elseif ('yearly' == $type) {
     
    783781                                $text = sprintf('%d', $arcresult->year);
    784782                                if ($show_post_count)
    785783                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    786                                 $output = get_archives_link($url, $text, $format, $before, $after);
    787                                 if ( $echo )
    788                                         echo $output;
    789                                 else
    790                                         return $output;         
     784                                $output .= get_archives_link($url, $text, $format, $before, $after);
    791785                        }
    792786                }
    793787        } elseif ( 'daily' == $type ) {
     
    809803                                $text = mysql2date($archive_day_date_format, $date);
    810804                                if ($show_post_count)
    811805                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    812                                 $output = get_archives_link($url, $text, $format, $before, $after);
    813                                 if ( $echo )
    814                                         echo $output;
    815                                 else
    816                                         return $output;
     806                                $output .= get_archives_link($url, $text, $format, $before, $after);
    817807                        }
    818808                }
    819809        } elseif ( 'weekly' == $type ) {
     
    842832                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
    843833                                                if ($show_post_count)
    844834                                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    845                                                 $output = get_archives_link($url, $text, $format, $before, $after);
    846                                                 if ( $echo )
    847                                                         echo $output;
    848                                                 else
    849                                                         return $output;
     835                                                $output .= get_archives_link($url, $text, $format, $before, $after);
    850836                                        }
    851837                                }
    852838                }
    853839        } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
    854                 ('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC ";
     840                $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
    855841                $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
    856842                $key = md5($query);
    857843                $cache = wp_cache_get( 'wp_get_archives' , 'general');
     
    871857                                                $text = strip_tags(apply_filters('the_title', $arc_title));
    872858                                        else
    873859                                                $text = $arcresult->ID;
    874                                         $output = get_archives_link($url, $text, $format, $before, $after);
    875                                         if ( $echo )
    876                                                 echo $output;
    877                                         else
    878                                                 return $output;
     860                                        $output .= get_archives_link($url, $text, $format, $before, $after);
    879861                                }
    880862                        }
    881863                }
    882864        }
     865        if ( $echo )
     866                echo $output;
     867        else
     868                return $output;
    883869}
    884870
    885871/**