Home › Forums › Calendar Products › Events Calendar PRO › Custom Event Attributes
- This topic has 12 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
June 8, 2012 at 11:30 am #20387
Chris
ParticipantI’d like to add a clickable URL as a custom attribute. How can I do this?
June 9, 2012 at 8:47 am #20407Jonah
ParticipantHi Chris,
In order to do this you’ll need to echo that specific custom attribute into an HTML a tag in the place you want it to display like so: https://gist.github.com/2901504
You can place that in any of the template view files – list.php, single.php, etc. For more info on the template views and how to use them, take a look at our Themer’s guide: https://theeventscalendar.com/support/documentation/events-calendar-themers-guide/
Cheers,
JonahJune 10, 2012 at 5:25 pm #20447Chris
ParticipantI sort of see what you’re saying. What I’m trying to do is create a custom attribute that has a dynamic URL. So, whatever is entered in the backend becomes a URL on the front end. EX: http://anywhere5k.com/event/sarah-garcia-anywhere5k/
June 10, 2012 at 8:50 pm #20457Jonah
ParticipantHi Chris,
Right, so you’ll want to create some additional dt/dd tags in /wp-content/plugins/the-events-calendar/views/single.php with the label of the field you want to display and then the custom field code spitting out the URL wrapped in a tags to make it a link. Take a look at my comment here for an example: https://gist.github.com/2901504#comments
– Jonah
June 17, 2012 at 7:58 am #20736Chris
ParticipantThanks Jonah. Adding the add’l tags makes that field permanent. If the registration field is not used then the field is displayed linking to the existing event. If the field is used, then both fields are displayed.
Code: http://cl.ly/3w0w3w441h0A0x1Y1n0g
Live: http://cl.ly/0J333a2c3M3l0w1v3f3uIn the “Live” image I’d like to make that URL active. Perhaps if the text in the text field is a URL it is active, or perhaps it’d be easier to create an add’l field as a URL (http://cl.ly/0L2m051F2d2C2l0n451y)
June 17, 2012 at 8:41 pm #20756Jonah
ParticipantHey Chris,
Yep, so what you’ll need to do is remove the stock code for displaying custom event fields and then conditionally display all the fields you want to display in whatever order you want them. You can run a conditional check for your registration field before it’s displayed like so:
if(tribe_get_custom_field('Registration')) {
//display the dt/dd tags and custom field
}
Make sure to wrap the above in appropriate PHP code too 😉– Jonah
June 18, 2012 at 6:33 am #20769Chris
ParticipantThanks Jonah. That worked splendidly. Since I’ve removed the stock code, how will I display the other field types? Using the stock code but referencing the field specifically?
June 18, 2012 at 6:53 am #20770Chris
ParticipantAnd one more for good measure. If the field is blank, how do I keep it from being displayed? I’ve tried copying from what you wrote for the other fields, but keep getting errors.
June 18, 2012 at 7:54 am #20772Chris
ParticipantOK, I figured out my second question. Just moved the closing tag to after the list items.
http://cl.ly/0n0n2q0U1B2B1y2k2W1p
Still unsure about how to handle the other field types since I removed the stock code.
Chris
June 18, 2012 at 8:38 am #20775Jonah
ParticipantHey Chris,
For the other fields you’re going to need to reference each one specifically. Let me know if you have any other questions.
Thanks,
JonahJune 18, 2012 at 10:16 am #20785Chris
ParticipantThanks Jonah. I figured as much.
BTW, are you all planning to incorporate URL or other types of add’l fields in the future?
June 18, 2012 at 11:05 am #20793Jonah
ParticipantHi Chris,
I doubt it, URL is not really a common field on it’s own for a custom field and a text field is all that’s needed. Feel free to cast your vote for that though in this thread: https://theeventscalendar.com/support/forums/topic/events-calendar-pro-feature-requests/
Cheers,
JonahJuly 7, 2015 at 6:21 am #977109Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Custom Event Attributes’ is closed to new replies.
