Skip to content

Instantly share code, notes, and snippets.

@nerrad
Created March 7, 2014 21:57
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 nerrad/9421067 to your computer and use it in GitHub Desktop.
Save nerrad/9421067 to your computer and use it in GitHub Desktop.
Example for dynamic css class generators for use in EE
<?php
//here's the example function
function get_ticket_css_class( EE_Ticket $ticket, $context = 'ticket-item' ) {
return apply_filters( 'FHEE__get_ticket_css_class', $context . '-' . sanitize_title( $ticket->get('TKT_name') ), $ticket, $context );
}
//then in html template
?>
<tr class="<?php echo get_ticket_css_class($ticket, 'ticket-row'); ?>">
<?php
//another example except this one is for datetime
function get_datetime_css_class( EE_Datetime $datetime, $context = 'datetime-item' ) {
return apply_filters( 'FHEE__get_datetime_css_class', $context . '-' . sanitize_title( $datetime->get("DTT_name")), $datetime, $context );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment