Custom Event Attributes

Home Forums Calendar Products Events Calendar PRO Custom Event Attributes

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #20387
    Chris
    Participant

    I’d like to add a clickable URL as a custom attribute. How can I do this?

    #20407
    Jonah
    Participant

    Hi 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,
    Jonah

    #20447
    Chris
    Participant

    I 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/

    #20457
    Jonah
    Participant

    Hi 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

    #20736
    Chris
    Participant

    Thanks 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/0J333a2c3M3l0w1v3f3u

    In 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)

    #20756
    Jonah
    Participant

    Hey 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

    #20769
    Chris
    Participant

    Thanks 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?

    #20770
    Chris
    Participant

    And 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.

    #20772
    Chris
    Participant

    OK, 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

    #20775
    Jonah
    Participant

    Hey 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,
    Jonah

    #20785
    Chris
    Participant

    Thanks Jonah. I figured as much.

    BTW, are you all planning to incorporate URL or other types of add’l fields in the future?

    #20793
    Jonah
    Participant

    Hi 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,
    Jonah

    #977109
    Support Droid
    Keymaster

    This 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.

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Custom Event Attributes’ is closed to new replies.