I added a required Website URL field for the front end submission, but that URL is now nowhere to be found in the admin page nor meta of the event.
How to utilize the additional form fields?
Daniel Roos
Hi Daniel,
Additional form fields which are not ‘event’ fields require a meta data key to store the data under. What meta key did you use?
Stephen Harris
metakey “website”
Can not find any information on how to use it in the view or how to find it under the regular admin page of the event.
Daniel Roos
Ok, in that case you should be able to see it under the “Custom Fields” metabox (if you can’t see this metabox, then check screen options on the top right to ensure it’s visible).
You get can retrieve this data via get_post_meta()
(see documentation to this here). The post ID is the the event ID.
In a template file you might get a custom field value like so:
$url = get_post_meta( get_the_ID(), 'website', true );
Stephen Harris
Edit: If i had actually read your link in your post i would have found the file to insert it in: wp-includes/post.php
-
This reply was modified 9 years, 9 months ago by Lars Vemund Solerød.
Lars Vemund Solerød
Lars, I would strong recommend against editing core files :).
The single event page template uses single.php
(unless your theme contains an single-event.php
), but the actual event details (including map, date(s) etc) are included by the template file event-organiser/templates/event-meta-event-single.php
(which you should copy into your theme before editing).
Hope that helps!
Stephen Harris
Tnx for your help, but can’t get this to work. Probably due to lack of PHP-skills.
I’ve edited event-organiser/templates/event-meta-event-single.php with the following content from line 44:
<div class=”entry-content”>
<!– Get event information, see template: event-meta-event-single.php –>
<?php eo_get_template_part(‘event-meta’,’event-single’); ?>
<!-- The content or the description of the event-->
<?php
$eventlink = get_post_meta(get_the_ID(), 'website', true);
if($eventlink){
?>
<a>" title="Link:">$eventlink</a>
<?php
}
?>
</div>
<!– .entry-content –>
Do you spot the error?
Lars Vemund Solerød
Hi Lars,
The forums use markdown if you need to display code (just write/paste in the code normally (no encoding), highlight it and click the curly braces icon is the easiest way).
He’s how to display the event list
$eventlink = get_post_meta(get_the_ID(), 'website', true);
if( $eventlink ){
printf( '<a href="%s">%s</a>', esc_url( $eventlink ), esc_html( $eventlink ) );
}
Stephen Harris