Skip to content
This repository has been archived by the owner on Apr 21, 2018. It is now read-only.

Commit

Permalink
Use the post_class filter rather than conditionals in the template fi…
Browse files Browse the repository at this point in the history
…les.
  • Loading branch information
kwight committed May 4, 2014
1 parent ef19836 commit 0adac15
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions content.php
Expand Up @@ -5,8 +5,7 @@
*/
?>

<?php $class = ( has_post_thumbnail() ) ? 'debut-has-thumb' : NULL; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $class ); ?>>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php
if ( has_post_thumbnail() ) { ?>
Expand Down
14 changes: 14 additions & 0 deletions functions.php
Expand Up @@ -518,6 +518,20 @@ function debut_body_classes( $classes ) {
add_filter( 'body_class', 'debut_body_classes' );


/**
* Adds custom classes to the array of post classes.
*
* @since 1.7
*/
function debut_post_classes( $classes ) {
if ( has_post_thumbnail() ) {
$classes[] = 'debut-has-thumb';
}
return $classes;
}
add_filter( 'post_class', 'debut_post_classes' );


/**
* Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
*
Expand Down

0 comments on commit 0adac15

Please sign in to comment.