• Resolved daudtivan

    (@daudtivan)


    I would like to display a grid of events with its date above the title. My events are no more than woocommerce product, so in essence, it’s a product list.

    But I need to get its date from a custom field created by FooEvents.

    They provide a snippet to use within woocommerce.

    Can you pls help transpose it to your plugin?

    Display the event date before the title on the product page

    function fooevents_display_date_on_single() {
    global $post;
    $product = wc_get_product( $post->ID );
    $start_date = $product->get_meta( 'WooCommerceEventsDate' );
    $end_date = $product->get_meta( 'WooCommerceEventsEndDate' );
    if ( $end_date ) {
    printf(
    '<h3>%s</h3>',
    esc_html( $start_date . ' - ' . $end_date )
    );
    } else if( $start_date ) {
    printf(
    '<h3>%s</h3>',
    esc_html( $start_date )
    );
    }
    }
    add_action( 'woocommerce_single_product_summary', 'fooevents_display_date_on_single' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YMC

    (@wssoffice21)

    Hi!
    If you want to customize the post (product) card in our plugin, you should use the plugin hooks (filter) – add_filter(‘ymc_post_custom_layout_545_1’, ‘my_custom_post_layout’, 10, 5);
    See documentation – https://github.com/YMC-22/smart-filter
    Then inside the card you can use all available Woocommerce API

    In addition, specify in the plugin settings the filter type with the name Custom Layout

    • This reply was modified 6 months, 4 weeks ago by YMC.
    Thread Starter daudtivan

    (@daudtivan)

    Thanks. I’m not really a php programmer, but will give it a try.

    And thank you for the quick reply!

    Thread Starter daudtivan

    (@daudtivan)

    You mean set filter to “Custom Filter Layout” under “Filter Layout” settings?

    I can’t find an exact Filter Type you referred to in your previous reply.

    Any advice is appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘display event date on card (custom field)?’ is closed to new replies.