1071 | | // Quick check. If we have no posts at all, abort! |
1072 | | if ( !$posts ) { |
| 1071 | // Quick check if at least one element in $posts is published post |
| 1072 | if ( $posts ) { |
| 1073 | $flag=false; |
| 1074 | foreach($posts as $post){ |
| 1075 | if($post->post_type == 'post' && $post->post_status == 'publish'){ |
| 1076 | $flag = true; |
| 1077 | break; |
| 1078 | } |
| 1079 | } |
| 1080 | //If we still don't know if we have or no published posts |
| 1081 | if(!$flag){ |
| 1082 | $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1"); |
| 1083 | if ( !$gotsome ) { |
| 1084 | $cache[ $key ] = ''; |
| 1085 | wp_cache_set( 'get_calendar', $cache, 'calendar' ); |
| 1086 | return; |
| 1087 | } |
| 1088 | } |
| 1089 | // If we have no posts at all, abort! |
| 1090 | } else { |