Hi,
I am customizing my single-event.php page using the event-meta-event-single.php page. I manage to add my own custom ID but I cannot get the name.
for example, I have a custom meta tag called eo_point_person_email, and my code is:
<?php if ( get_post_meta( get_the_ID(), ‘eo_pt_person_phone’, true )) { ?>
Point Person Phone: <?php echo esc_html( get_post_meta( get_the_ID(), ‘eo_pt_person_phone’, true) ); ?>
<?php } ?>
this works fine. But I cannot query the name: Why is this not working?
<?php if ( get_the_terms( get_the_ID(), ‘name’ ) ) { ?>
Point Person Name: <?php echo get_the_term_list( get_the_ID(),’name’, ”, ‘, ‘, ” ); ?>
<?php } ?>
Webmaster CCC
Those functions get the terms associated to the post that are in the ‘name’ taxonomy. Do you have a ‘name’ taxonomy registered?
You mention you are trying to get the. How are you getting that data and where is stored? In a custom field?
Stephen Harris
Hi,
In the FES form editor, the name corresponds to the field: Name – ID:’name’.
It was there on default, with the First and Last name field. It does not have a field for “meta_key” so I am assuming this is a registered taxonomy in the custom post ‘event’, but I don’t know exactly how to grab them.
Tradditionally, I would do this:
$the_query = new WP_Query( array(
'post_type' => 'event',
'tax_query' => array(
array (
'taxonomy' => 'name',
)
),
) );
while ( $the_query->have_posts() ) :
$the_query->the_post();
// Show Posts ...
endwhile;
wp_reset_postdata();
But this is already in a loop in event-meta-event-single.php page. How would I query the first and last name of this ID:’name’ ?
Webmaster CCC
Right, so I just changed the label from ‘Name’ to ‘Staff Point Person’, but really, it was there in FES form editor already.
Webmaster CCC
Ah, I see. You can use the following to get information about the submitter:
$display_name = eo_fes_get_submitted_event_meta( get_the_ID(), 'submitter_display_name' );
$first_name = eo_fes_get_submitted_event_meta( get_the_ID(), 'submitter_first_name' );
$last_name = eo_fes_get_submitted_event_meta( get_the_ID(), 'submitter_last_name' );
$submitter_email = eo_fes_get_submitted_event_meta( get_the_ID(), 'submitter_email' );
Stephen Harris