Hello!
Is there a way to add other details to an evenement ?
An example here : http://www.owly.fr/evenements/evenement/mika/
I’d like to add a “facebook page link” field for example.
Thanks!
Alex

Alexandre Janvier
Yes, one way of doing this is to make use of custom fields. These are no different from the custom fields you get on posts, so I’ll refer to you the codex for details: https://codex.wordpress.org/Custom_Fields
If you want that included with the event details, you should copy the template event-organiser/templates/event-meta-single-event.php
into your theme and edit to include:
<?php
printf(
'<a href="%s">Facebook page</a>',
esc_url( get_post_meta( get_the_ID, 'facebook_url', true ) )
);
?>
where I have assumed facebook_url
is the custom field key. You may want to wrap it inside a conditional to check that the value for facebook_url
is not empty (i.e. a url hasn’t been provided), otherwise the link will point nowhere.

Stephen Harris
Hello Stephen,
Thank you for your help and sorry to respond to your lately.
I tried what you said and mentionned regarding “Custom fields” but unfortunately it seems to do not work fine :-S .
Here is what i have for my example :
printf('Facebook: Visiter', esc_url( get_post_meta( get_the_ID, 'facebook_url', true ) ) ); printf('<br/>');
And here is what I did in my wordpress admin page of the event (sorry it’s in french) :

And nothing is done, it does not work. Can you help me on it ?
Thank you,
Regards,
Alex

Alexandre Janvier
Please see this page on how to use printf
: http://php.net/manual/en/function.printf.php
It will replace placeholders (e.g. %s
), with the values you provide – in your case you are not using any placeholders, just the literal text Facebook: Visiter

Stephen Harris
It was not the code provided in my message, it has been automatically modified by the forum 🙁
printf('Facebook: Visiter', esc_url( get_post_meta( get_the_ID, 'facebook_url', true ) ) );
I hope this time it will work ^^

Alexandre Janvier
Ok, hum…. still the same…
You can find the real code posted here :
http://owly.fr/autre/exemple1.txt

Alexandre Janvier
I see, and I see that your previous code snippets have not rendered correctly.
You are using get_the_ID
, it should be get_the_ID()
, i.e.
printf( '<strong>Facebook:</strong> <a href="%s">Visiter</a>', esc_url( get_post_meta( get_the_ID(), 'facebook_url', true ) ) );
(The forum uses markdown, by the way)

Stephen Harris