Add echo option to wp_get_archives(). Props ShaneF. fixes #7749
git-svn-id: https://develop.svn.wordpress.org/trunk@8902 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ebe59173cd
commit
c5bc4b90c3
|
@ -642,7 +642,8 @@ function wp_get_archives($args = '') {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'type' => 'monthly', 'limit' => '',
|
'type' => 'monthly', 'limit' => '',
|
||||||
'format' => 'html', 'before' => '',
|
'format' => 'html', 'before' => '',
|
||||||
'after' => '', 'show_post_count' => false
|
'after' => '', 'show_post_count' => false,
|
||||||
|
'echo' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = wp_parse_args( $args, $defaults );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
|
@ -697,7 +698,11 @@ function wp_get_archives($args = '') {
|
||||||
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
|
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
|
||||||
if ( $show_post_count )
|
if ( $show_post_count )
|
||||||
$after = ' ('.$arcresult->posts.')' . $afterafter;
|
$after = ' ('.$arcresult->posts.')' . $afterafter;
|
||||||
echo get_archives_link($url, $text, $format, $before, $after);
|
$output = get_archives_link($url, $text, $format, $before, $after);
|
||||||
|
if ( $echo )
|
||||||
|
echo $output;
|
||||||
|
else
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ('yearly' == $type) {
|
} elseif ('yearly' == $type) {
|
||||||
|
@ -718,7 +723,11 @@ function wp_get_archives($args = '') {
|
||||||
$text = sprintf('%d', $arcresult->year);
|
$text = sprintf('%d', $arcresult->year);
|
||||||
if ($show_post_count)
|
if ($show_post_count)
|
||||||
$after = ' ('.$arcresult->posts.')' . $afterafter;
|
$after = ' ('.$arcresult->posts.')' . $afterafter;
|
||||||
echo get_archives_link($url, $text, $format, $before, $after);
|
$output = get_archives_link($url, $text, $format, $before, $after);
|
||||||
|
if ( $echo )
|
||||||
|
echo $output;
|
||||||
|
else
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'daily' == $type ) {
|
} elseif ( 'daily' == $type ) {
|
||||||
|
@ -740,7 +749,11 @@ function wp_get_archives($args = '') {
|
||||||
$text = mysql2date($archive_day_date_format, $date);
|
$text = mysql2date($archive_day_date_format, $date);
|
||||||
if ($show_post_count)
|
if ($show_post_count)
|
||||||
$after = ' ('.$arcresult->posts.')'.$afterafter;
|
$after = ' ('.$arcresult->posts.')'.$afterafter;
|
||||||
echo get_archives_link($url, $text, $format, $before, $after);
|
$output = get_archives_link($url, $text, $format, $before, $after);
|
||||||
|
if ( $echo )
|
||||||
|
echo $output;
|
||||||
|
else
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'weekly' == $type ) {
|
} elseif ( 'weekly' == $type ) {
|
||||||
|
@ -769,7 +782,11 @@ function wp_get_archives($args = '') {
|
||||||
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
|
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
|
||||||
if ($show_post_count)
|
if ($show_post_count)
|
||||||
$after = ' ('.$arcresult->posts.')'.$afterafter;
|
$after = ' ('.$arcresult->posts.')'.$afterafter;
|
||||||
echo get_archives_link($url, $text, $format, $before, $after);
|
$output = get_archives_link($url, $text, $format, $before, $after);
|
||||||
|
if ( $echo )
|
||||||
|
echo $output;
|
||||||
|
else
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,7 +811,11 @@ function wp_get_archives($args = '') {
|
||||||
$text = strip_tags(apply_filters('the_title', $arc_title));
|
$text = strip_tags(apply_filters('the_title', $arc_title));
|
||||||
else
|
else
|
||||||
$text = $arcresult->ID;
|
$text = $arcresult->ID;
|
||||||
echo get_archives_link($url, $text, $format, $before, $after);
|
$output = get_archives_link($url, $text, $format, $before, $after);
|
||||||
|
if ( $echo )
|
||||||
|
echo $output;
|
||||||
|
else
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue