Advertisement
BakerMan

Using the venue slug as a CSS class

Feb 11th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. // Get the venue ID for this event
  2. $venueID = tribe_get_venue_id();
  3.  
  4. // Check that a valid venue ID was returned ("0" may be returned if none is assigned)
  5. if (is_numeric($venueID) and $venueID > 0) {
  6.     // Get the slug
  7.     $venue = get_post($venueID);
  8.     $venueSlug = $venue->post_name;
  9. }
  10. else {
  11.     // Otherwise, set the slug to an empty string
  12.     $venueSlug = '';
  13. }
  14.  
  15. // Take $venueSlug and use as CSS class
  16. echo '<div class="'.$venueSlug.'">'; // etc...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement