Add Additional Field to Details Meta

Home Forums Calendar Products Events Calendar PRO Add Additional Field to Details Meta

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #948318
    Jason
    Participant

    I have two additional fields ‘Total Cost’ and ‘Payment Plan’ I’d like to add to the details section on the single-event.php I know it’s in the modules/meta/details.php I’m just getting lost on what to add, I will also need an IF statement as not every event will have these.

    Any help would be greatly appreciated.

    Jason

    #948357
    George
    Participant

    Hey Jason,

    Since you mentioned knowing the source file for modifying the display of Event Details, you may have already seen this page, but regardless, the first thing you should do is read through our official Themer’s Guide here → https://theeventscalendar.com/knowledgebase/themers-guide/

    That will give you instructions on how to modify the event details from within your theme, instead of modifying core plugin files. This is much better and will ensure that you don’t lose your changes if you update the plugin.

    Once you have a version of the details template in your theme that you can modify and play around with, to display meta information you’ll want to use the WordPress function get_post_meta(). You can learn more about this function here →

    Basically, on your custom details template, you can use code like the following wherever you want to display custom event meta:

    
    $event_id = get_the_ID();
    
    $total_cost_meta = get_post_meta( $event_id, '_example_total_cost', true );
    $payment_plan_meta = get_post_meta( $event_id, '_example_payment_plan', true );
    
    if ( ! empty( $total_cost_meta ) ) {
        echo esc_html( $total_cost_meta );
    }
    
    if ( ! empty( $payment_plan_meta) ) {
        echo '<strong>' . esc_html( $payment_plan_meta ) . '</strong>';
    }
    

    Note that this is just an example, play around with things and read the materials I recommended here, it should help quite a bit. Let us know if it does! 🙂

    Cheers,
    George

    #983863
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Add Additional Field to Details Meta’ is closed to new replies.