Added ability to output archives as options (just add select tag)
git-svn-id: http://svn.automattic.com/wordpress/trunk@292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a1813a9120
commit
966a388a92
|
@ -113,15 +113,17 @@ function single_month_title($prefix = '', $display = true ) {
|
||||||
/* link navigation hack by Orien http://icecode.com/ */
|
/* link navigation hack by Orien http://icecode.com/ */
|
||||||
function get_archives_link($url, $text, $format) {
|
function get_archives_link($url, $text, $format) {
|
||||||
if ('link' == $format) {
|
if ('link' == $format) {
|
||||||
echo '<link rel="Archives" title="'.$text.'" href="'.$url.'" />'."\n";
|
return '<link rel="Archives" title="'.$text.'" href="'.$url.'" />'."\n";
|
||||||
} else {
|
} else if ('option' == $format) {
|
||||||
echo '<li><a href="'.$url.'" title="'.$text.'">'.$text.'</a></li>'."\n";
|
return '<option value="'.$url.'">'.$text.'</option>'."\n";
|
||||||
|
} else { // 'html'
|
||||||
|
return '<li><a href="'.$url.'" title="'.$text.'">'.$text.'</a></li>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_archives($type='', $limit='', $format='html') {
|
function get_archives($type='', $limit='', $format='html') {
|
||||||
global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename;
|
global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename;
|
||||||
GLOBAL $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
|
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
|
||||||
|
|
||||||
if ('' == $type) {
|
if ('' == $type) {
|
||||||
$type = get_settings('archive_mode');
|
$type = get_settings('archive_mode');
|
||||||
|
@ -163,7 +165,7 @@ function get_archives($type='', $limit='', $format='html') {
|
||||||
foreach ($arcresults as $arcresult) {
|
foreach ($arcresults as $arcresult) {
|
||||||
$url = sprintf("%s%d%02d", $archive_link_m, $arcresult->year, $arcresult->month);
|
$url = sprintf("%s%d%02d", $archive_link_m, $arcresult->year, $arcresult->month);
|
||||||
$text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year);
|
$text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year);
|
||||||
get_archives_link($url, $text, $format);
|
echo get_archives_link($url, $text, $format);
|
||||||
}
|
}
|
||||||
} elseif ('daily' == $type) {
|
} elseif ('daily' == $type) {
|
||||||
++$querycount;
|
++$querycount;
|
||||||
|
@ -172,7 +174,7 @@ function get_archives($type='', $limit='', $format='html') {
|
||||||
$url = sprintf("%s%d%02d%02d", $archive_link_m, $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
|
$url = sprintf("%s%d%02d%02d", $archive_link_m, $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
|
||||||
$date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
|
$date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
|
||||||
$text = mysql2date($archive_day_date_format, $date);
|
$text = mysql2date($archive_day_date_format, $date);
|
||||||
get_archives_link($url, $text, $format);
|
echo get_archives_link($url, $text, $format);
|
||||||
}
|
}
|
||||||
} elseif ('weekly' == $type) {
|
} elseif ('weekly' == $type) {
|
||||||
if (!isset($start_of_week)) {
|
if (!isset($start_of_week)) {
|
||||||
|
@ -192,7 +194,7 @@ function get_archives($type='', $limit='', $format='html') {
|
||||||
$querystring_equal, $arc_year, $querystring_separator,
|
$querystring_equal, $arc_year, $querystring_separator,
|
||||||
$querystring_equal, $arcresult->week);
|
$querystring_equal, $arcresult->week);
|
||||||
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
|
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
|
||||||
get_archives_link($url, $text, $format);
|
echo get_archives_link($url, $text, $format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ('postbypost' == $type) {
|
} elseif ('postbypost' == $type) {
|
||||||
|
@ -207,7 +209,7 @@ function get_archives($type='', $limit='', $format='html') {
|
||||||
} else {
|
} else {
|
||||||
$text = $arcresult->ID;
|
$text = $arcresult->ID;
|
||||||
}
|
}
|
||||||
get_archives_link($url, $text, $format);
|
echo get_archives_link($url, $text, $format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -873,7 +875,6 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||||
}
|
}
|
||||||
$query .= " ORDER BY $sort_column $sort_order, post_date DESC";
|
$query .= " ORDER BY $sort_column $sort_order, post_date DESC";
|
||||||
|
|
||||||
|
|
||||||
$categories = $wpdb->get_results($query);
|
$categories = $wpdb->get_results($query);
|
||||||
++$querycount;
|
++$querycount;
|
||||||
echo "<select name='cat' class='postform'>\n";
|
echo "<select name='cat' class='postform'>\n";
|
||||||
|
|
Loading…
Reference in New Issue