Skip to content

Commit

Permalink
Why the hell would $posts be an instance of a single Post, I ask you?…
Browse files Browse the repository at this point in the history
… Why?

*blows brains out*
  • Loading branch information
chrismeller committed Nov 25, 2011
1 parent 3c593b8 commit 3fedf50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/theme.php
Expand Up @@ -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 ) {
Expand Down

3 comments on commit 3fedf50

@michaeltwofish
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrismeller
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree with you.

Please sign in to comment.