Make WordPress Core

Ticket #25938: 25938.1.diff

File 25938.1.diff, 892 bytes (added by obenland, 10 years ago)

Let's just not add the post class if outside the loop.

  • wp-content/themes/twentyfourteen/functions.php

     
    415415 * Extend the default WordPress post classes.
    416416 *
    417417 * Adds a post class to denote:
    418  * Non-password protected page with a post thumbnail.
     418 * Non-password protected page or post, with a post thumbnail, and not outside
     419 * the loop.
    419420 *
    420421 * @since Twenty Fourteen 1.0
    421422 *
     
    423424 * @return array The filtered post class list.
    424425 */
    425426function twentyfourteen_post_classes( $classes ) {
    426         if ( ! post_password_required() && has_post_thumbnail() )
     427        if ( in_the_loop() && ! post_password_required() && has_post_thumbnail() )
    427428                $classes[] = 'has-post-thumbnail';
    428429        else
    429430                $classes[] = 'no-post-thumbnail';