element add_filter( 'genesis_attr_entry-content', 'my_attr_content' ); function my_attr_content( $attr ) { $attr['id'] .= 'content'; return $attr; } //add_action( 'genesis_entry_header', 'ycb_event_meta', 5); //add_action( 'genesis_entry_header', 'ycb_event_register_button', 10); function ycb_event_meta() { global $post; $EM_Event = em_get_event($post->ID, 'post_id'); echo '
'; $event_start_date = get_post_meta( get_the_ID(), _event_start_date ,true); if ( $event_start_date ) { $format_in = 'Y-m-d'; // the format your value is saved in (set in the field options) $format_out = 'd/m/Y'; // the format you want to end up with $event_start_date = DateTime::createFromFormat($format_in, $event_start_date); echo ''. $event_start_date->format( $format_out ) .''; } echo ' | '; echo $EM_Event->output('#_LOCATIONTOWN'); echo '
'; } function ycb_event_register_button() { $register_link = get_post_meta( get_the_ID(), event_register_link ,true); //echo '
Chi tiết'; if ( $register_link ){ echo 'Đăng Ký'; } //echo '
'; } //* Reposition Breadcrumbs remove_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_breadcrumbs' ); add_action( 'genesis_before_entry', 'genesis_do_breadcrumbs', 9 ); //* Remove the entry meta in the entry header remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); //* Remove the author box on single posts HTML5 Themes remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 ); /** * Display Featured Image floated to the right in single Posts. * * @author Sridhar Katakam * @link http://sridharkatakam.com/how-to-display-featured-image-in-single-posts-in-genesis/ */ function ycb_event_image() { $image_args = array( 'size' => 'full', ); echo '
'; if ($image_args) { genesis_image( $image_args ); } echo '
'; } function ycb_event_distance() { $product_terms = get_the_terms( get_the_ID(), 'distance' ); // Make sure we have terms and also check for WP_Error object if ( $product_terms && !is_wp_error( $product_terms )) { // Display your terms as normal $term_list = []; foreach ( $product_terms as $term ) $term_list[] = esc_html( $term->name ); } return implode( ', ', $term_list ); } function ycb_display_event_organizer() { $event_organizer = get_the_terms( get_the_ID(), 'organizer' ); // Make sure we have terms and also check for WP_Error object if ( $event_organizer && !is_wp_error( $event_organizer )) { // Display your terms as normal $term_list = []; foreach ( $event_organizer as $term ) $term_list[] = esc_html( $term->name ); } return implode( ', ', $term_list ); //echo '

Ban tổ chức

'; /*echo '';*/ } add_action( 'genesis_entry_content', 'ycb_event_image', 10 ); add_action( 'genesis_entry_content', 'ycb_event_info', 10 ); //add_action( 'genesis_entry_content', 'ycb_event_register_button', 10); function ycb_event_info_backup() { global $post; $EM_Event = em_get_event($post->ID, 'post_id'); $event_website = get_post_meta( get_the_ID(), event_website ,true); $event_title = get_the_title(); $register_link = get_post_meta( get_the_ID(), event_register_link ,true); $event_facebook = get_post_meta( get_the_ID(), event_facebook_page,true); $event_distance = ycb_event_distance(); echo '
'; // Echo the event info on the left side echo '
'; /* echo '

'; if ($event_website) { echo ''; } if ($event_facebook) { echo ''; } echo '

';*/ echo '

Tên giải: '; echo ' '.$event_title.'

'; echo '

Cự ly: '.$event_distance. '

'; //echo do_shortcode('[post_terms taxonomy="distance" before=""]').'

'; echo '

Phân loại: '; echo do_shortcode('[post_terms taxonomy="event_category" before=""]').'

'; echo '

'; echo '

Thời gian: '; echo $EM_Event->output('#_EVENTDATES').'

'; if (!empty($EM_Event->location_id) && $EM_Event->get_location()->location_status) { echo '

Địa điểm: '; //echo $EM_Event->output('#_LOCATIONLINK'); echo ''. $EM_Event->output('#_LOCATIONADDRESS') . ', '; echo $EM_Event->output('#_LOCATIONTOWN') . ', '; echo $EM_Event->output('#_LOCATIONCOUNTRY') . '

'; } echo '
'; // Echo the event map on the right side /*echo '
'; echo $EM_Event->output('#_LOCATIONMAP'); echo '
';*/ echo '
'; /*if ($event_facebook) { echo '
'; echo do_shortcode('[sfp-page-plugin url="' . $event_facebook .'"]'); echo '
'; }*/ echo '
'; echo $EM_Event->output('#_LOCATIONMAP'); echo '
'; echo '
'; } function ycb_event_info() { global $post; $EM_Event = em_get_event($post->ID, 'post_id'); $event_website = get_post_meta( get_the_ID(), event_website ,true); $event_title = get_the_title(); $register_link = get_post_meta( get_the_ID(), event_register_link ,true); $event_facebook = get_post_meta( get_the_ID(), event_facebook_page,true); $event_distance = ycb_event_distance(); $event_organizer = ycb_display_event_organizer(); echo '
'; // Echo the event info on the left side echo '
'; echo '
Website:
'; if ($event_website) { echo '
'.$event_title.'
'; } else if ($event_facebook) { echo '
'.$event_title.'
'; } echo '
'; if ($event_organizer) { echo '
'; echo '
Ban tổ chức:
'; echo '
'. $event_organizer . '
'; //echo do_shortcode('[post_terms taxonomy="organizer" before=""]').''; echo '
'; } echo '
'; echo '
Cự ly:
'.$event_distance. '
'; //echo do_shortcode('[post_terms taxonomy="distance" before=""]').'

'; echo '
'; $event_type = do_shortcode('[post_terms taxonomy="event_category" before=""]'); if ($event_type) { echo '
'; echo '
Phân loại:
'; echo $event_type .'
'; echo '
'; } echo '
'; echo '
Thời gian:
'; echo '
'.$EM_Event->output('#_EVENTDATES').'
'; echo '
'; if (!empty($EM_Event->location_id) && $EM_Event->get_location()->location_status) { echo '
'; echo '
Địa điểm:
'; echo '
'. $EM_Event->output('#_LOCATIONADDRESS') . ', '; echo $EM_Event->output('#_LOCATIONTOWN') . ', '; echo $EM_Event->output('#_LOCATIONCOUNTRY') . '
'; echo '
'; } echo '
'; // Echo the event map echo '
'; echo $EM_Event->output('#_LOCATIONMAP'); echo '
'; echo '
'; echo '
'; ycb_event_register_button(); echo '
'; } /*if ($event_facebook) { echo '
'; echo do_shortcode('[sfp-page-plugin url="' . $event_facebook .'"]'); echo '
'; }*/ //* Add custom body class to the head add_filter( 'body_class', 'event_body_class' ); function event_body_class( $classes ) { if ( has_post_thumbnail()) { $classes[] = 'single-event-media'; } return $classes; } // Display new sidebar for Event //add_action('get_header','cd_change_genesis_sidebar'); function cd_change_genesis_sidebar() { remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); //remove the default genesis sidebar add_action( 'genesis_sidebar', 'ycb_event_do_sidebar' ); //add an action hook to call the function for my custom sidebar } //Function to output my custom sidebar function ycb_event_do_sidebar() { genesis_widget_area( 'single-event-sidebar' ); } function ycb_event_hero_markup_open_1() { echo '
'; } function ycb_event_hero_markup_open() { remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); if ( has_post_thumbnail() ) { $bg_image = genesis_get_image( array( 'format' => 'url', 'size' => 'full', ) ); } if ( $bg_image ) { $output = '
'; } echo $output; } function ycb_event_hero_markup_close() { echo '
'; } add_action( 'corporate_hero_section', 'ycb_event_meta', 10); add_action( 'corporate_hero_section', 'ycb_event_register_button', 10); add_action ( 'genesis_entry_footer' , 'ycb_other_events', 15); function ycb_other_events() { echo ''; } genesis();