Last active
February 22, 2016 03:25
-
-
Save melissajclark/c7b61fa892387161f2af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controlling the class on an article in the WordPress loop | |
* Notes: | |
* | |
* <?php post_class(); ?> - this outputs the WordPress generated class for categories | |
* You can add classes by adding them inside this function. It will still output the WordPress classes | |
* | |
*/ | |
?> | |
<?php if ( is_category('example') ) : ?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class('example-class'); ?>> | |
<?php elseif ( is_category('example-2') ) : ?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class('example-class-2'); ?>> | |
<?php else : // if it's not those categories then do this?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment