Limit get_lastpost* functions to post_type=post. Props Denis-de-Bernardy. fixes #9636
git-svn-id: http://svn.automattic.com/wordpress/trunk@11108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
aac9c56084
commit
430a8cb2cf
|
@ -1118,7 +1118,7 @@ EOD;
|
|||
<?php endif; ?>
|
||||
<link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" />
|
||||
<link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" />
|
||||
<rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights>
|
||||
<rights type="text">Copyright <?php echo date('Y'); ?></rights>
|
||||
<?php the_generator( 'atom' ); ?>
|
||||
<?php if ( have_posts() ) {
|
||||
while ( have_posts() ) {
|
||||
|
|
|
@ -2931,13 +2931,13 @@ function get_lastpostdate($timezone = 'server') {
|
|||
if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) {
|
||||
switch(strtolower($timezone)) {
|
||||
case 'gmt':
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'blog':
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'server':
|
||||
$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
break;
|
||||
}
|
||||
$cache_lastpostdate[$blog_id][$timezone] = $lastpostdate;
|
||||
|
@ -2970,13 +2970,13 @@ function get_lastpostmodified($timezone = 'server') {
|
|||
if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) {
|
||||
switch(strtolower($timezone)) {
|
||||
case 'gmt':
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'blog':
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'server':
|
||||
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
break;
|
||||
}
|
||||
$lastpostdate = get_lastpostdate($timezone);
|
||||
|
|
Loading…
Reference in New Issue