Skip to content

Instantly share code, notes, and snippets.

@coenjacobs
Forked from remkus/gist:1235165
Created November 23, 2011 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coenjacobs/1389756 to your computer and use it in GitHub Desktop.
Save coenjacobs/1389756 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/
* @tested WordPress 3.2.1
* @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