Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Why the hell would $posts be an instance of a single Post, I ask you?…

… Why?

*blows brains out*
  • Loading branch information...
commit 3fedf50dcb2608422b797cad38592aab2bb521c1 1 parent 3c593b8
@chrismeller chrismeller authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 classes/theme.php
View
5 classes/theme.php
@@ -343,9 +343,12 @@ public function act_display( $paramarray = array( 'user_filters'=> array() ) )
if ( isset( $posts ) && count( $posts ) > 0 ) {
// actually find the most recent post in the list, just in case they've been re-ordered
- if ( count( $posts ) == 1 ) {
+ if ( $posts instanceof Post ) {
$newest_post = $posts;
}
+ else if ( count( $posts ) == 1 ) {
+ $newest_post = $posts[0];
+ }
else {
$newest_post = reset( $posts ); // prime with the first one, just so we've got a real object
foreach ( $posts as $post ) {

3 comments on commit 3fedf50

@chrismeller

Well, it shouldn't be... If it's going to be a single post it should be in $post, that's where I would expect it. $posts should still be an array with only the one post in it. Whether or not that means the underlying Posts class should change or not, I don't know... that's just how I expect the API in Theme to work when fetching them.

@michaeltwofish

I don't disagree with you.

Please sign in to comment.
Something went wrong with that request. Please try again.