Created
March 7, 2014 21:57
-
-
Save nerrad/9421067 to your computer and use it in GitHub Desktop.
Example for dynamic css class generators for use in EE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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