Created
November 3, 2015 15:05
-
-
Save anthonysbrown/e0c4b5e7369e34b7de3b to your computer and use it in GitHub Desktop.
Events Manager Pro - Add attending alert on single event page if attending
This file contains hidden or 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 | |
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