Last active
November 3, 2015 15:03
-
-
Save anthonysbrown/b6d2662b21eeb505826f to your computer and use it in GitHub Desktop.
Events Manager Pro highlight RVP'd event on month view
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_events(){ | |
global $current_user; | |
$args = array( | |
'post_type' => 'tribe_events','posts_per_page'=>-1, 'post_status' => 'publish' | |
); | |
$get_events = new WP_Query( $args ); | |
$events = $get_events->get_posts(); | |
foreach($events as $event) { | |
$attendies = get_post_meta($event->ID, '_eventrocket_attendance', true ); | |
if(is_array($attendies)){ | |
foreach($attendies as $key=>$value){ | |
if($key == $current_user->ID && $value == 1){ | |
$attending[] = $event->ID; | |
} | |
} | |
} | |
} | |
wp_reset_query(); | |
if(count($attending)>0){ | |
echo '<style type="text/css">'; | |
foreach ($attending as $key=>$value){ | |
echo '.post-'.$value.' h3 a {color:#6eff3c !important}'; | |
} | |
echo '</style>'; | |
} | |
} | |
add_action('tribe_events_before_template', 'highlight_attending_events'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment