Skip to content

Instantly share code, notes, and snippets.

@remkus
Created September 22, 2011 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save remkus/1235165 to your computer and use it in GitHub Desktop.
Save remkus/1235165 to your computer and use it in GitHub Desktop.
Example of WordPress coding standards
<?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;
}
@remkus
Copy link
Author

remkus commented Apr 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment