Created
September 22, 2011 16:02
-
-
Save remkus/1235165 to your computer and use it in GitHub Desktop.
Example of WordPress coding standards
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 | |
add_filter( 'body_class' , 'ft_add_guest_body_class' ); | |
/** | |
* Adds a body class for guests. | |
* | |
* @author Remkus de Vries | |
* @link http://remkusdevries.com/when-sharing-wordpress-related-code-snippets-i-can-haz-standards-please/ | |
* @param array $classes Existing body classes | |
* @return array Amended body classes | |
*/ | |
function ft_add_guest_body_class( $classes ) { | |
// add 'not-loggedin' to the $classes array | |
if ( ! is_user_logged_in() ) | |
$classes[] = 'not-logged-in'; | |
// return the $classes array | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Proper WordPress coding standards. More info here http://remkusdevries.com/when-sharing-wordpress-related-code-snippets-i-can-haz-standards-please/