Skip to content

Instantly share code, notes, and snippets.

@adamculpepper
Last active August 29, 2015 14:07
Show Gist options
  • Save adamculpepper/709034500b096c9d3895 to your computer and use it in GitHub Desktop.
Save adamculpepper/709034500b096c9d3895 to your computer and use it in GitHub Desktop.
ExpressionEngine Body Class Clean-up (cleans up all the tabs and break lines so the classes are all on one line)
<!--
Stash: http://devot-ee.com/add-ons/stash
Strip Line Breaks: http://devot-ee.com/add-ons/strip-line-breaks
Low Replace: http://devot-ee.com/add-ons/low-replace
-->
{exp:stash:set parse_tags="yes" parse_conditionals="yes" parse_depth="5" type="snippet"}
{exp:strip_line_breaks}
{stash:body_classes}
{exp:low_replace find="\t" replace="" regex="yes"}
{structure:top:slug}
{if segment_1 == ''}home{/if}
{if segment_2} {segment_2}{/if}
{if segment_3} {segment_3}{/if}
{if segment_2 != ''} sub{/if}
{if segment_2 == "agent-forms" || segment_2 == "policyholder-forms"} document-forms{/if}
{if segment_2 == "our-mission" || segment_2 == "our-team" || segment_2 == "underwriting-marketing-team"} team{/if}
{if logged_in} logged-in{/if}
{/exp:low_replace}
{/stash:body_classes}
{/exp:strip_line_breaks}
{/exp:stash:set}
<body class="{exp:stash:get type='snippet' name='body_classes'}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment