Skip to content

Instantly share code, notes, and snippets.

@anthonysbrown
Created November 3, 2015 15:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonysbrown/e0c4b5e7369e34b7de3b to your computer and use it in GitHub Desktop.
Save anthonysbrown/e0c4b5e7369e34b7de3b to your computer and use it in GitHub Desktop.
Events Manager Pro - Add attending alert on single event page if attending
<?php
function highlight_attending_single(){
global $post,$current_user;
$attendies = get_post_meta($post->ID, '_eventrocket_attendance', true );
$attending = false;
if(is_array($attendies)){
foreach($attendies as $key=>$value){
if($key == $current_user->ID && $value == 1){
$attending =true;
}
}
}
if($attending == true){
echo '<div style="background-color:#dbffcf;color:green;padding:15px;margin:15px;font-size:1.3em;text-align:center">You are attending this event</div>';
}
}
add_action('tribe_events_single_event_before_the_content', 'highlight_attending_single');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment