Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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