Pulling Meta data
-
Hello,
I’m laying out a page with Post and Events in a grid and want to keep the layout consistent. I’m using the Kadence Post block to pull in the Posts and Events using the code below. It works to some extent except for the Event start time and the Event location. I’m using ‘mec_start_time’ for the start time and ‘mec_location’ for the Venue but both are turning up empty. Should i be using other variable names?
Hope you can help.
Thanks<?php
add_action('kadence_blocks_post_loop_content', 'custom_evnts_meta_loop', 25, 1); function custom_evnts_meta_loop( $atts ) { if ( 'mec-events' == $atts['postType'] ) { ?> <div class="event-meta"> <p class="event-date"><strong>Event Date:</strong> <?php echo get_post_meta( get_the_ID(), 'mec_start_date', true); ?> <p class="event-time"><strong>Start at:</strong> <?php echo get_post_meta( get_the_ID(), 'mec_start_time', true); ?> <p class="event-location"><strong>Location:</strong> <?php echo get_post_meta( get_the_ID(), 'mec_location', true); ?> <p class="event-costs"><strong>Costs:</strong> <?php echo get_post_meta( get_the_ID(), 'mec_cost', true); ?> </p> </div> <?php } }
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pulling Meta data’ is closed to new replies.