Overview

Namespaces

  • EventPost
  • None

Classes

  • EventPost
  • EventPost\Children
  • EventPost\Icons
  • EventPost\Multisite
  • EventPost\Settings
  • EventPost\Shortcodes
  • EventPost\Taxonomies
  • EventPost_Cal
  • EventPost_List
  • EventPost_Map
  • EventPost_Search
  • EventPostWeather

Functions

  • event_post_format_color
  • event_post_get_all_terms
  • eventdetails_block_init
  • EventPost
  • EventPost\product_event_tab
  • EventPost\woocommerce_product_tabs
  • EventPost\woocommerce_rich_result
  • eventpost_list_block_init
  • eventpost_timeline_block_init
  • eventscalendar_block_init
  • eventsmap_block_init
  • get_the_date_end
  • get_the_date_start
  • get_the_dates
  • get_the_location
  • the_date_end
  • the_date_start
  • the_dates
  • the_location
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 
<?php
/**
 * Support for WooCommerce
 *
 * @package event-post
 * @version 5.9.11
 * @since   5.8.0
 */

namespace EventPost;

\add_filter( 'woocommerce_product_tabs', '\EventPost\woocommerce_product_tabs' );
\add_filter( 'event-post-rich-result', '\EventPost\woocommerce_rich_result', 10, 2 );

function woocommerce_product_tabs($tabs){
    $event = \EventPost()->retreive();
    if($event && $event->start){
        $tabs['event-post'] = [
            'title' => __('Event', 'event-post'),
            'priority' => 20,
            'callback' => '\EventPost\product_event_tab',
        ];
    }
    return $tabs;
}

function product_event_tab($key, $tab){
    $event = \EventPost()->retreive();
    if($event){
        \EventPost()->load_map_scripts();
        include plugin_dir_path( __DIR__ ) . 'views/product-tab.php';
    }
}

function woocommerce_rich_result($rich_data, $event){
    $gmt_offset = get_option('gmt_offset ');
    if($event->post_type == 'product'){
        $rich_data['offers'] = array(
            '@type'=>'Offer',
            'url'=>get_permalink($event->ID),
            'price'=>\EventPost()->get_price($event),
            'priceCurrency'=>get_woocommerce_currency(),
            'availability'=>'https://schema.org/InStock',
            'validFrom'=>str_replace(' ', 'T', $event->post_date_gmt).$gmt_offset,
        );
    }
    return $rich_data;
}
API documentation generated by ApiGen