Skip to content

Instantly share code, notes, and snippets.

@joshdcomp
Last active December 16, 2015 19:19
Show Gist options
  • Save joshdcomp/5484581 to your computer and use it in GitHub Desktop.
Save joshdcomp/5484581 to your computer and use it in GitHub Desktop.
Utility snippet for a group of accordions parsing an array to determine the classnames the accordion container should receive.
$parentString = '';
$parentString .= ( $menu['is_current'] )
? 'is_current '
: '';
$parentString .= empty( $subMenu )
? ''
: 'is_parent ';
$parentString .= ( $menu['is_current'] || !empty($isParent) )
? 'open'
: '';
@joshdcomp
Copy link
Author

The first revision was dirty and stupid (as I thought), so I refactored it to this

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