• Resolved aaron19888

    (@aaron19888)


    Hi,

    I have created some fields inside field editor called:

    Start Event Date
    Start Event Time
    End Event Date
    End Event Time

    now how can i display these on front-end using Template Overrides i have the folder: wp-event-manager and added file: content-single-event_listing.php but i am not sure how to show the meta key and value?

    Thanks

    • This topic was modified 4 years, 9 months ago by aaron19888.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @aaron19888,
    You will find the meta key of your field in the field editor. Please take this meta key and use get_post_meta(EVENT_ID,'_KEY_FROM_FIELD_EDITOR',true);

    I hope this helps.
    Thank you

    Thread Starter aaron19888

    (@aaron19888)

    Hi,

    Thanks, do i need to change the EVENT_ID ? to anything?

    Thread Starter aaron19888

    (@aaron19888)

    As this is how i have it inside my single file.

    <div class="wpem-event-date-time" >
    	            <span class="wpem-event-date-time-text" itemprop="startDate" content="<?php echo $start_date;?>"><?php display_event_start_date();?> <?php if(get_event_start_time()){ display_date_time_separator(); ?> <?php display_event_start_time(); }?></span>
    	            <br/>
    	            <span class="wpem-event-date-time-text" itemprop="endDate" content="<?php echo $end_date;?>">
    	            <?php if( get_event_start_date() != get_event_end_date() ) {  display_event_end_date(); } ?>
    	            <?php if(get_event_end_time()){ display_date_time_separator() ?> <?php display_event_end_time(); } ?>
    <?php get_post_meta(EVENT_ID,'_start_event_date',true); ?>
    	            </span>
                </div>

    Is what my field is but it does not seem to be showing when added i went into an event and added it as and the field is a Date field?

    Hi @aaron19888,

    Please replace the EVENT_ID with get_the_ID().

    <div class="wpem-event-date-time" >
    	            <span class="wpem-event-date-time-text" itemprop="startDate" content="<?php echo $start_date;?>"><?php display_event_start_date();?> <?php if(get_event_start_time()){ display_date_time_separator(); ?> <?php display_event_start_time(); }?></span>
    	            <br/>
    	            <span class="wpem-event-date-time-text" itemprop="endDate" content="<?php echo $end_date;?>">
    	            <?php if( get_event_start_date() != get_event_end_date() ) {  display_event_end_date(); } ?>
    	            <?php if(get_event_end_time()){ display_date_time_separator() ?> <?php display_event_end_time(); } ?>
    <?php get_post_meta(get_the_ID(),'_start_event_date',true); ?>
    	            </span>
                </div>

    I am not sure if there is already an event start date and event end date in the template file why you want to add again?

    Make sure that you are adding the correct value.
    Thank you

    Thread Starter aaron19888

    (@aaron19888)

    Hi,

    Basically have an event ?? but we 2 dates so:

    9th May 10:00 – 18:00
    10th May 10:00 – 18:00

    So same event but finishes a different time on 10th so only way i could see this working was adding an extra date and time field, then add to the template file.

    to show this. Also for some reason the field is still not showing ??

               <div class="wpem-event-date-time" >
    	            <span class="wpem-event-date-time-text" itemprop="startDate" content="<?php echo $start_date;?>"><?php display_event_start_date();?> <?php if(get_event_start_time()){ display_date_time_separator(); ?> <?php display_event_start_time(); }?></span>
    	            <br/>
    	            <span class="wpem-event-date-time-text" itemprop="endDate" content="<?php echo $end_date;?>">
    	            <?php if( get_event_start_date() != get_event_end_date() ) {  display_event_end_date(); } ?>
    	            <?php if(get_event_end_time()){ display_date_time_separator() ?> <?php display_event_end_time(); } ?>
    				
    				<?php get_post_meta(get_the_ID(),'_start',true); ?>
    				
    	            </span>
                </div>

    Just checked the event and it does have the start date i changed the field name just incase was conflicting tried different browsers also.

    Thanks

    Hi @aaron19888,

    Please create a support ticket here

    Thank you

    Hi @aaron19888,

    You just need to update the one line in above code
    <?php echo get_post_meta(get_the_ID(),'_start',true); ?>

    This will print the value without echo it won’t print anything.

    Thank you

    Thread Starter aaron19888

    (@aaron19888)

    Oops i feel such a plonky now lol ??

    If i do _start can i use this same code:

    <span class="wpem-event-date-time-text" itemprop="endDate" content="<?php echo $_date;?>">
    	            <?php if( get_event_start_date() != get_event_end_date() ) {  display_event_end_date(); } ?>
    	            <?php if(get_event_end_time()){ display_date_time_separator() ?> <?php display_event_end_time(); } ?>
    	            </span>

    but change to use _start etc? so it displays like:

    Saturday, May 9, 2020 ?

    Thanks

    • This reply was modified 4 years, 9 months ago by aaron19888.
    Thread Starter aaron19888

    (@aaron19888)

    Also another thing how come the original code is displaying like this: Saturday, May 9, 2020 @ 10:00
    @ 18:00 instead of : Saturday, May 9, 2020 @ 10:00 – 18:00 ?

    Thanks

    Hi @aaron19888,

    Please convert value into your date format by following this doc
    https://wordpress.stackexchange.com/questions/12031/converting-custom-field-date-format

    Thank you

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘custom field help’ is closed to new replies.