Ticket #7749: 7749.diff
File 7749.diff, 3.2 KB (added by , 16 years ago) |
---|
-
wp-includes/general-template.php
740 740 $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); 741 741 $join = apply_filters('getarchives_join', "", $r); 742 742 743 $output = ''; 744 743 745 if ( 'monthly' == $type ) { 744 746 $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"; 745 747 $key = md5($query); … … 758 760 $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year); 759 761 if ( $show_post_count ) 760 762 $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); 766 764 } 767 765 } 768 766 } elseif ('yearly' == $type) { … … 783 781 $text = sprintf('%d', $arcresult->year); 784 782 if ($show_post_count) 785 783 $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); 791 785 } 792 786 } 793 787 } elseif ( 'daily' == $type ) { … … 809 803 $text = mysql2date($archive_day_date_format, $date); 810 804 if ($show_post_count) 811 805 $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); 817 807 } 818 808 } 819 809 } elseif ( 'weekly' == $type ) { … … 842 832 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 843 833 if ($show_post_count) 844 834 $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); 850 836 } 851 837 } 852 838 } 853 839 } 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 "; 855 841 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; 856 842 $key = md5($query); 857 843 $cache = wp_cache_get( 'wp_get_archives' , 'general'); … … 871 857 $text = strip_tags(apply_filters('the_title', $arc_title)); 872 858 else 873 859 $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); 879 861 } 880 862 } 881 863 } 882 864 } 865 if ( $echo ) 866 echo $output; 867 else 868 return $output; 883 869 } 884 870 885 871 /**