| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
function get_header() { |
|---|
| 6 |
do_action( 'get_header' ); |
|---|
| 7 |
if ( file_exists( TEMPLATEPATH . '/header.php') ) |
|---|
| 8 |
load_template( TEMPLATEPATH . '/header.php'); |
|---|
| 9 |
else |
|---|
| 10 |
load_template( ABSPATH . 'wp-content/themes/default/header.php'); |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
function get_footer() { |
|---|
| 15 |
do_action( 'get_footer' ); |
|---|
| 16 |
if ( file_exists( TEMPLATEPATH . '/footer.php') ) |
|---|
| 17 |
load_template( TEMPLATEPATH . '/footer.php'); |
|---|
| 18 |
else |
|---|
| 19 |
load_template( ABSPATH . 'wp-content/themes/default/footer.php'); |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
function get_sidebar() { |
|---|
| 24 |
do_action( 'get_sidebar' ); |
|---|
| 25 |
if ( file_exists( TEMPLATEPATH . '/sidebar.php') ) |
|---|
| 26 |
load_template( TEMPLATEPATH . '/sidebar.php'); |
|---|
| 27 |
else |
|---|
| 28 |
load_template( ABSPATH . 'wp-content/themes/default/sidebar.php'); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
function wp_loginout() { |
|---|
| 33 |
if ( ! is_user_logged_in() ) |
|---|
| 34 |
$link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Login') . '</a>'; |
|---|
| 35 |
else |
|---|
| 36 |
$link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>'; |
|---|
| 37 |
|
|---|
| 38 |
echo apply_filters('loginout', $link); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
function wp_register( $before = '<li>', $after = '</li>' ) { |
|---|
| 43 |
|
|---|
| 44 |
if ( ! is_user_logged_in() ) { |
|---|
| 45 |
if ( get_option('users_can_register') ) |
|---|
| 46 |
$link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after; |
|---|
| 47 |
else |
|---|
| 48 |
$link = ''; |
|---|
| 49 |
} else { |
|---|
| 50 |
$link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after; |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
echo apply_filters('register', $link); |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
function wp_meta() { |
|---|
| 58 |
do_action('wp_meta'); |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
function bloginfo($show='') { |
|---|
| 63 |
echo get_bloginfo($show, 'display'); |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
function get_bloginfo($show = '', $filter = 'raw') { |
|---|
| 73 |
|
|---|
| 74 |
switch($show) { |
|---|
| 75 |
case 'url' : |
|---|
| 76 |
case 'home' : |
|---|
| 77 |
case 'siteurl' : |
|---|
| 78 |
$output = get_option('home'); |
|---|
| 79 |
break; |
|---|
| 80 |
case 'wpurl' : |
|---|
| 81 |
$output = get_option('siteurl'); |
|---|
| 82 |
break; |
|---|
| 83 |
case 'description': |
|---|
| 84 |
$output = get_option('blogdescription'); |
|---|
| 85 |
break; |
|---|
| 86 |
case 'rdf_url': |
|---|
| 87 |
$output = get_feed_link('rdf'); |
|---|
| 88 |
break; |
|---|
| 89 |
case 'rss_url': |
|---|
| 90 |
$output = get_feed_link('rss'); |
|---|
| 91 |
break; |
|---|
| 92 |
case 'rss2_url': |
|---|
| 93 |
$output = get_feed_link('rss2'); |
|---|
| 94 |
break; |
|---|
| 95 |
case 'atom_url': |
|---|
| 96 |
$output = get_feed_link('atom'); |
|---|
| 97 |
break; |
|---|
| 98 |
case 'comments_atom_url': |
|---|
| 99 |
$output = get_feed_link('comments_atom'); |
|---|
| 100 |
break; |
|---|
| 101 |
case 'comments_rss2_url': |
|---|
| 102 |
$output = get_feed_link('comments_rss2'); |
|---|
| 103 |
break; |
|---|
| 104 |
case 'pingback_url': |
|---|
| 105 |
$output = get_option('siteurl') .'/xmlrpc.php'; |
|---|
| 106 |
break; |
|---|
| 107 |
case 'stylesheet_url': |
|---|
| 108 |
$output = get_stylesheet_uri(); |
|---|
| 109 |
break; |
|---|
| 110 |
case 'stylesheet_directory': |
|---|
| 111 |
$output = get_stylesheet_directory_uri(); |
|---|
| 112 |
break; |
|---|
| 113 |
case 'template_directory': |
|---|
| 114 |
case 'template_url': |
|---|
| 115 |
$output = get_template_directory_uri(); |
|---|
| 116 |
break; |
|---|
| 117 |
case 'admin_email': |
|---|
| 118 |
$output = get_option('admin_email'); |
|---|
| 119 |
break; |
|---|
| 120 |
case 'charset': |
|---|
| 121 |
$output = get_option('blog_charset'); |
|---|
| 122 |
if ('' == $output) $output = 'UTF-8'; |
|---|
| 123 |
break; |
|---|
| 124 |
case 'html_type' : |
|---|
| 125 |
$output = get_option('html_type'); |
|---|
| 126 |
break; |
|---|
| 127 |
case 'version': |
|---|
| 128 |
global $wp_version; |
|---|
| 129 |
$output = $wp_version; |
|---|
| 130 |
break; |
|---|
| 131 |
case 'language': |
|---|
| 132 |
$output = get_locale(); |
|---|
| 133 |
$output = str_replace('_', '-', $output); |
|---|
| 134 |
break; |
|---|
| 135 |
case 'text_direction': |
|---|
| 136 |
global $wp_locale; |
|---|
| 137 |
$output = $wp_locale->text_direction; |
|---|
| 138 |
break; |
|---|
| 139 |
case 'name': |
|---|
| 140 |
default: |
|---|
| 141 |
$output = get_option('blogname'); |
|---|
| 142 |
break; |
|---|
| 143 |
} |
|---|
| 144 |
|
|---|
| 145 |
$url = true; |
|---|
| 146 |
if (strpos($show, 'url') === false && |
|---|
| 147 |
strpos($show, 'directory') === false && |
|---|
| 148 |
strpos($show, 'home') === false) |
|---|
| 149 |
$url = false; |
|---|
| 150 |
|
|---|
| 151 |
if ( 'display' == $filter ) { |
|---|
| 152 |
if ( $url ) |
|---|
| 153 |
$output = apply_filters('bloginfo_url', $output, $show); |
|---|
| 154 |
else |
|---|
| 155 |
$output = apply_filters('bloginfo', $output, $show); |
|---|
| 156 |
} |
|---|
| 157 |
|
|---|
| 158 |
return $output; |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
function wp_title($sep = '»', $display = true) { |
|---|
| 163 |
global $wpdb, $wp_locale, $wp_query; |
|---|
| 164 |
|
|---|
| 165 |
$cat = get_query_var('cat'); |
|---|
| 166 |
$tag = get_query_var('tag_id'); |
|---|
| 167 |
$p = get_query_var('p'); |
|---|
| 168 |
$name = get_query_var('name'); |
|---|
| 169 |
$category_name = get_query_var('category_name'); |
|---|
| 170 |
$author = get_query_var('author'); |
|---|
| 171 |
$author_name = get_query_var('author_name'); |
|---|
| 172 |
$m = get_query_var('m'); |
|---|
| 173 |
$year = get_query_var('year'); |
|---|
| 174 |
$monthnum = get_query_var('monthnum'); |
|---|
| 175 |
$day = get_query_var('day'); |
|---|
| 176 |
$title = ''; |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
if ( !empty($cat) ) { |
|---|
| 180 |
|
|---|
| 181 |
if ( !stristr($cat,'-') ) |
|---|
| 182 |
$title = apply_filters('single_cat_title', get_the_category_by_ID($cat)); |
|---|
| 183 |
} elseif ( !empty($category_name) ) { |
|---|
| 184 |
if ( stristr($category_name,'/') ) { |
|---|
| 185 |
$category_name = explode('/',$category_name); |
|---|
| 186 |
if ( $category_name[count($category_name)-1] ) |
|---|
| 187 |
$category_name = $category_name[count($category_name)-1]; |
|---|
| 188 |
else |
|---|
| 189 |
$category_name = $category_name[count($category_name)-2]; |
|---|
| 190 |
} |
|---|
| 191 |
$cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display'); |
|---|
| 192 |
if ( $cat ) |
|---|
| 193 |
$title = apply_filters('single_cat_title', $cat->name); |
|---|
| 194 |
} |
|---|
| 195 |
|
|---|
| 196 |
if ( !empty($tag) ) { |
|---|
| 197 |
$tag = get_term($tag, 'post_tag', OBJECT, 'display'); |
|---|
| 198 |
if ( is_wp_error( $tag ) ) |
|---|
| 199 |
return $tag; |
|---|
| 200 |
if ( ! empty($tag->name) ) |
|---|
| 201 |
$title = apply_filters('single_tag_title', $tag->name); |
|---|
| 202 |
} |
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
if ( !empty($author) ) { |
|---|
| 206 |
$title = get_userdata($author); |
|---|
| 207 |
$title = $title->display_name; |
|---|
| 208 |
} |
|---|
| 209 |
if ( !empty($author_name) ) { |
|---|
| 210 |
|
|---|
| 211 |
$title = $wpdb->get_var("SELECT display_name FROM $wpdb->users WHERE user_nicename = '$author_name'"); |
|---|
| 212 |
} |
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
if ( !empty($m) ) { |
|---|
| 216 |
$my_year = substr($m, 0, 4); |
|---|
| 217 |
$my_month = $wp_locale->get_month(substr($m, 4, 2)); |
|---|
| 218 |
$my_day = intval(substr($m, 6, 2)); |
|---|
| 219 |
$title = "$my_year" . ($my_month ? "$sep $my_month" : "") . ($my_day ? "$sep $my_day" : ""); |
|---|
| 220 |
} |
|---|
| 221 |
|
|---|
| 222 |
if ( !empty($year) ) { |
|---|
| 223 |
$title = $year; |
|---|
| 224 |
if ( !empty($monthnum) ) |
|---|
| 225 |
$title .= " $sep " . $wp_locale->get_month($monthnum); |
|---|
| 226 |
if ( !empty($day) ) |
|---|
| 227 |
$title .= " $sep " . zeroise($day, 2); |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
if ( is_single() || is_page() ) { |
|---|
| 232 |
$post = $wp_query->get_queried_object(); |
|---|
| 233 |
$title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) ); |
|---|
| 234 |
} |
|---|
| 235 |
|
|---|
| 236 |
$prefix = ''; |
|---|
| 237 |
if ( !empty($title) ) |
|---|
| 238 |
$prefix = " $sep "; |
|---|
| 239 |
|
|---|
| 240 |
$title = $prefix . $title; |
|---|
| 241 |
$title = apply_filters('wp_title', $title, $sep); |
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
if ( $display ) |
|---|
| 245 |
echo $title; |
|---|
| 246 |
else |
|---|
| 247 |
return $title; |
|---|
| 248 |
} |
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
function single_post_title($prefix = '', $display = true) { |
|---|
| 252 |
global $wpdb; |
|---|
| 253 |
$p = get_query_var('p'); |
|---|
| 254 |
$name = get_query_var('name'); |
|---|
| 255 |
|
|---|
| 256 |
if ( intval($p) || '' != $name ) { |
|---|
| 257 |
if ( !$p ) |
|---|
| 258 |
$p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'"); |
|---|
| 259 |
$post = & get_post($p); |
|---|
| 260 |
$title = $post->post_title; |
|---|
| 261 |
$title = apply_filters('single_post_title', $title); |
|---|
| 262 |
if ( $display ) |
|---|
| 263 |
echo $prefix.strip_tags($title); |
|---|
| 264 |
else |
|---|
| 265 |
return strip_tags($title); |
|---|
| 266 |
} |
|---|
| 267 |
} |
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
function single_cat_title($prefix = '', $display = true ) { |
|---|
| 271 |
$cat = intval( get_query_var('cat') ); |
|---|
| 272 |
if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) { |
|---|
| 273 |
$my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat)); |
|---|
| 274 |
if ( !empty($my_cat_name) ) { |
|---|
| 275 |
if ( $display ) |
|---|
| 276 |
echo $prefix.strip_tags($my_cat_name); |
|---|
| 277 |
else |
|---|
| 278 |
return strip_tags($my_cat_name); |
|---|
| 279 |
} |
|---|
| 280 |
} else if ( is_tag() ) { |
|---|
| 281 |
return single_tag_title($prefix, $display); |
|---|
| 282 |
} |
|---|
| 283 |
} |
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
function single_tag_title($prefix = '', $display = true ) { |
|---|
| 287 |
if ( !is_tag() ) |
|---|
| 288 |
return; |
|---|
| 289 |
|
|---|
| 290 |
$tag_id = intval( get_query_var('tag_id') ); |
|---|
| 291 |
|
|---|
| 292 |
if ( !empty($tag_id) ) { |
|---|
| 293 |
$my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display'); |
|---|
| 294 |
if ( is_wp_error( $my_tag ) ) |
|---|
| 295 |
return false; |
|---|
| 296 |
$my_tag_name = apply_filters('single_tag_title', $my_tag->name); |
|---|
| 297 |
if ( !empty($my_tag_name) ) { |
|---|
| 298 |
if ( $display ) |
|---|
| 299 |
echo $prefix . $my_tag_name; |
|---|
| 300 |
else |
|---|
| 301 |
return $my_tag_name; |
|---|
| 302 |
} |
|---|
| 303 |
} |
|---|
| 304 |
} |
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 |
function single_month_title($prefix = '', $display = true ) { |
|---|
| 308 |
global $wp_locale; |
|---|
| 309 |
|
|---|
| 310 |
$m = get_query_var('m'); |
|---|
| 311 |
$year = get_query_var('year'); |
|---|
| 312 |
$monthnum = get_query_var('monthnum'); |
|---|
| 313 |
|
|---|
| 314 |
if ( !empty($monthnum) && !empty($year) ) { |
|---|
| 315 |
$my_year = $year; |
|---|
| 316 |
$my_month = $wp_locale->get_month($monthnum); |
|---|
| 317 |
} elseif ( !empty($m) ) { |
|---|
| 318 |
$my_year = substr($m, 0, 4); |
|---|
| 319 |
$my_month = $wp_locale->get_month(substr($m, 4, 2)); |
|---|
| 320 |
} |
|---|
| 321 |
|
|---|
| 322 |
if ( empty($my_month) ) |
|---|
| 323 |
return false; |
|---|
| 324 |
|
|---|
| 325 |
$result = $prefix . $my_month . $prefix . $my_year; |
|---|
| 326 |
|
|---|
| 327 |
if ( !$display ) |
|---|
| 328 |
return $result; |
|---|
| 329 |
echo $result; |
|---|
| 330 |
} |
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') { |
|---|
| 335 |
$text = wptexturize($text); |
|---|
| 336 |
$title_text = attribute_escape($text); |
|---|
| 337 |
$url = clean_url($url); |
|---|
| 338 |
|
|---|
| 339 |
if ('link' == $format) |
|---|
| 340 |
return "\t<link rel='archives' title='$title_text' href='$url' />\n"; |
|---|
| 341 |
elseif ('option' == $format) |
|---|
| 342 |
return "\t<option value='$url'>$before $text $after</option>\n"; |
|---|
| 343 |
elseif ('html' == $format) |
|---|
| 344 |
return "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n"; |
|---|
| 345 |
else |
|---|
| 346 |
return "\t$before<a href='$url' title='$title_text'>$text</a>$after\n"; |
|---|
| 347 |
} |
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
function wp_get_archives($args = '') { |
|---|
| 351 |
global $wpdb, $wp_locale; |
|---|
| 352 |
|
|---|
| 353 |
$defaults = array( |
|---|
| 354 |
'type' => 'monthly', 'limit' => '', |
|---|
| 355 |
'format' => 'html', 'before' => '', |
|---|
| 356 |
'after' => '', 'show_post_count' => false |
|---|
| 357 |
); |
|---|
| 358 |
|
|---|
| 359 |
$r = wp_parse_args( $args, $defaults ); |
|---|
| 360 |
extract( $r, EXTR_SKIP ); |
|---|
| 361 |
|
|---|
| 362 |
if ( '' == $type ) |
|---|
| 363 |
$type = 'monthly'; |
|---|
| 364 |
|
|---|
| 365 |
if ( '' != $limit ) { |
|---|
| 366 |
$limit = (int) $limit; |
|---|
| 367 |
$limit = ' LIMIT '.$limit; |
|---|
| 368 |
} |
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
$archive_week_separator = '–'; |
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
$archive_date_format_over_ride = 0; |
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
$archive_day_date_format = 'Y/m/d'; |
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
$archive_week_start_date_format = 'Y/m/d'; |
|---|
| 381 |
$archive_week_end_date_format = 'Y/m/d'; |
|---|
| 382 |
|
|---|
| 383 |
if ( !$archive_date_format_over_ride ) { |
|---|
| 384 |
$archive_day_date_format = get_option('date_format'); |
|---|
| 385 |
$archive_week_start_date_format = get_option('date_format'); |
|---|
| 386 |
$archive_week_end_date_format = get_option('date_format'); |
|---|
| 387 |
} |
|---|
| 388 |
|
|---|
| 389 |
$add_hours = intval(get_option('gmt_offset')); |
|---|
| 390 |
$add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); |
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
$where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); |
|---|
| 394 |
$join = apply_filters('getarchives_join', "", $r); |
|---|
| 395 |
|
|---|
| 396 |
if ( 'monthly' == $type ) { |
|---|
| 397 |
$arcresults = $wpdb->get_results("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); |
|---|
| 398 |
if ( $arcresults ) { |
|---|
| 399 |
$afterafter = $after; |
|---|
| 400 |
foreach ( $arcresults as $arcresult ) { |
|---|
| 401 |
$url = get_month_link($arcresult->year, $arcresult->month); |
|---|
| 402 |
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year); |
|---|
| 403 |
if ( $show_post_count ) |
|---|
| 404 |
$after = ' ('.$arcresult->posts.')' . $afterafter; |
|---|
| 405 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 406 |
} |
|---|
| 407 |
} |
|---|
| 408 |
} elseif ('yearly' == $type) { |
|---|
| 409 |
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit); |
|---|
| 410 |
if ($arcresults) { |
|---|
| 411 |
$afterafter = $after; |
|---|
| 412 |
foreach ($arcresults as $arcresult) { |
|---|
| 413 |
$url = get_year_link($arcresult->year); |
|---|
| 414 |
$text = sprintf('%d', $arcresult->year); |
|---|
| 415 |
if ($show_post_count) |
|---|
| 416 |
$after = ' ('.$arcresult->posts.')' . $afterafter; |
|---|
| 417 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 418 |
} |
|---|
| 419 |
} |
|---|
| 420 |
} elseif ( 'daily' == $type ) { |
|---|
| 421 |
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit); |
|---|
| 422 |
if ( $arcresults ) { |
|---|
| 423 |
$afterafter = $after; |
|---|
| 424 |
foreach ( $arcresults as $arcresult ) { |
|---|
| 425 |
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); |
|---|
| 426 |
$date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); |
|---|
| 427 |
$text = mysql2date($archive_day_date_format, $date); |
|---|
| 428 |
if ($show_post_count) |
|---|
| 429 |
$after = ' ('.$arcresult->posts.')'.$afterafter; |
|---|
| 430 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 431 |
} |
|---|
| 432 |
} |
|---|
| 433 |
} elseif ( 'weekly' == $type ) { |
|---|
| 434 |
$start_of_week = get_option('start_of_week'); |
|---|
| 435 |
$arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC" . $limit); |
|---|
| 436 |
$arc_w_last = ''; |
|---|
| 437 |
$afterafter = $after; |
|---|
| 438 |
if ( $arcresults ) { |
|---|
| 439 |
foreach ( $arcresults as $arcresult ) { |
|---|
| 440 |
if ( $arcresult->week != $arc_w_last ) { |
|---|
| 441 |
$arc_year = $arcresult->yr; |
|---|
| 442 |
$arc_w_last = $arcresult->week; |
|---|
| 443 |
$arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week')); |
|---|
| 444 |
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); |
|---|
| 445 |
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); |
|---|
| 446 |
$url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week); |
|---|
| 447 |
$text = $arc_week_start . $archive_week_separator . $arc_week_end; |
|---|
| 448 |
if ($show_post_count) |
|---|
| 449 |
$after = ' ('.$arcresult->posts.')'.$afterafter; |
|---|
| 450 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 451 |
} |
|---|
| 452 |
} |
|---|
| 453 |
} |
|---|
| 454 |
} elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) { |
|---|
| 455 |
('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC "; |
|---|
| 456 |
$arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"); |
|---|
| 457 |
if ( $arcresults ) { |
|---|
| 458 |
|---|