Skip to content

Instantly share code, notes, and snippets.

@anthonysbrown
Last active November 3, 2015 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonysbrown/b6d2662b21eeb505826f to your computer and use it in GitHub Desktop.
Save anthonysbrown/b6d2662b21eeb505826f to your computer and use it in GitHub Desktop.
Events Manager Pro highlight RVP'd event on month view
<?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