Make WordPress Core

Ticket #7749: 7749.1.diff

File 7749.1.diff, 2.5 KB (added by ShaneF, 17 years ago)

allow "echo" option. Default echo turned on

  • wp-includes/general-template.php

     
    642642        $defaults = array(
    643643                'type' => 'monthly', 'limit' => '',
    644644                'format' => 'html', 'before' => '',
    645                 'after' => '', 'show_post_count' => false
     645                'after' => '', 'show_post_count' => false,
     646                'echo' => 1
    646647        );
    647648
    648649        $r = wp_parse_args( $args, $defaults );
     
    697698                                $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
    698699                                if ( $show_post_count )
    699700                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    700                                 echo get_archives_link($url, $text, $format, $before, $after);
     701                                $output = get_archives_link($url, $text, $format, $before, $after);
     702                                if ( $echo )
     703                                        echo $output;
     704                                else
     705                                        return $output;
    701706                        }
    702707                }
    703708        } elseif ('yearly' == $type) {
     
    718723                                $text = sprintf('%d', $arcresult->year);
    719724                                if ($show_post_count)
    720725                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    721                                 echo get_archives_link($url, $text, $format, $before, $after);
     726                                $output = get_archives_link($url, $text, $format, $before, $after);
     727                                if ( $echo )
     728                                        echo $output;
     729                                else
     730                                        return $output;         
    722731                        }
    723732                }
    724733        } elseif ( 'daily' == $type ) {
     
    740749                                $text = mysql2date($archive_day_date_format, $date);
    741750                                if ($show_post_count)
    742751                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    743                                 echo get_archives_link($url, $text, $format, $before, $after);
     752                                $output = get_archives_link($url, $text, $format, $before, $after);
     753                                if ( $echo )
     754                                        echo $output;
     755                                else
     756                                        return $output;
    744757                        }
    745758                }
    746759        } elseif ( 'weekly' == $type ) {
     
    769782                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
    770783                                                if ($show_post_count)
    771784                                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    772                                                 echo get_archives_link($url, $text, $format, $before, $after);
     785                                                $output = get_archives_link($url, $text, $format, $before, $after);
     786                                                if ( $echo )
     787                                                        echo $output;
     788                                                else
     789                                                        return $output;
    773790                                        }
    774791                                }
    775792                }
     
    794811                                                $text = strip_tags(apply_filters('the_title', $arc_title));
    795812                                        else
    796813                                                $text = $arcresult->ID;
    797                                         echo get_archives_link($url, $text, $format, $before, $after);
     814                                        $output = get_archives_link($url, $text, $format, $before, $after);
     815                                        if ( $echo )
     816                                                echo $output;
     817                                        else
     818                                                return $output;
    798819                                }
    799820                        }
    800821                }