Help with Additional Fields – links, and display on Event List page

Home Forums Calendar Products Events Calendar PRO Help with Additional Fields – links, and display on Event List page

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #17569
    Kym
    Participant

    I searched the documentation and forum, but am not finding an answer to my question unless I’m not using good search terms…

    We purchased PRO partly to be able to display certain “custom fields” for each of our events. Specifically, we wanted to be able to display the link to the printable event flyer (PDF), and a link to our registration system (not eventbrite).

    Two questions. One: is it possible for us to add “additional fields” that will display as links? I’m getting the impression, from trying and from reading the documentation, that this isn’t possible… which is really disappointing…

    Two: it seems that when I add custom fields (additional fields), they are only displaying on the SINGLE EVENT page, not on the Event List view page? Is that the default? Could anyone point me in the right direction for adding certain custom fields that we’ve added to display on the EVENT LIST view (the area on the right that displays Start, End, Venue, etc.)? I’m comfortable with editing the PHP for our single event template, but I just haven’t been able to figure out how I would add specific additional fields. If there is documentation on this, I couldn’t find it, but a link would be great if there is such info.

    I hope this was concise enough and I explained our question well. Any help would be greatly appreciated.

    Kym

    #17594
    Jonah
    Participant

    Hi Kym, to answer your questions:

    1. Yes, you can display custom fields as links you just need to use the right code to retrieve the custom field for your links. By default in single.php we simply spit out all custom fields and links will not be turned into links, you need to do that yourself by specifically referencing that custom field in an html link tag like so: https://gist.github.com/17b7655a61e24d264a56 – note, you’ll either want to remove $eventID or replace with the actual ID in the loop.

    2. Custom fields don’t show in the list by default but you can easily add them there with the code I provided above for single fields or just copy the code for custom fields that’s in the single.php file on line 84 and use that in list.php (make a copy first and place in an ‘events’ folder in your theme).

    I think that answers your questions but let me know if you have any more with this.

    Cheers,
    Jonah

    #17726
    Kym
    Participant

    hi Jonah!
    For some reason I never got an email that my question was answered… just seeing your response now. You are my hero! Thank you so much.

    I do have another question now though…

    I added the code to the single.php page as you suggested, tweaked the placement and style to suit my needs. The one thing I can’t figure out though: right now, the code calls in tribe_get_custom_field(‘Registration Link’) which displays my “Register Now” link. It is ALSO displaying ALL of my custom fields through tribe_the_custom_fields. So, on one line it is displaying the text-only version of my registration link, and then under that it displays the new output I created for Click Here to Register Now.

    Is there a way to prevent tribe_the_custom_fields from displaying any output for a SINGLE custom field? I do not want to simply remove that line of code, as there are other custom fields that I would like to continue to display. I just don’t want the custom field for the registration link to display. I do realize I could remove that line, then hard-code in each individual custom field, but I don’t want to take away the ability for my client to add additional fields in the future.

    Once again, I am so grateful for your help! Thank you!

    #17736
    Jonah
    Participant

    Hi Kym, tribe_the_custom_fields will always get all of your custom fields, so no, there’s no way to exclude it with that function. This should do what you need it to though: https://gist.github.com/2344826

    Basically you just use the unset function from PHP to unset the custom field label you want from the array. I’m echoing the label and value for every other custom field found and feel free to wrap those in whatever markup you want. And, make sure to change the label in the unset function to the label of the custom field you want to exclude.

    I hope that works!

    #17762
    Kym
    Participant

    Thank you Jonah – you are very, very helpful! I will give this a try. Thanks!!

    #17782
    Rob
    Member

    Awesome to hear this did the trick, Kym! Let us know what else we can do down the road.

    #17815
    Amanda Schnelle
    Participant

    What about when the custom field doesn’t have a value? The link still appears. Rob – suggestion for next update – make URL a drop-down option for custom fields…

    #17823
    Kym
    Participant

    Amanda – I second that feature request. That would be awesome. If I can add to that:
    My client’s situation is that they would like a “To Register” custom field. Usually, that would be a link to the registration page, which is what I’m using the code generated above for. BUT, there are some cases where an event they are posting does NOT have a registration link. Some events say “To register, call 555-555-5555” or “Registration Not Required.” Using the code Jonah provided works perfectly when there’s a link, but now, for events with no link, a completely different custom field must be used.

    If Amanda’s suggestion could be implemented, I’d put a twist on it like this: it would be cool if I can add “Registration information” custom field. In the value box, we would type either “Click here to register” or “Call 555-555-5555 to register.” THEN, for the case of “Click here to register” there would then be a checkbox for link, and a separate value field where a URL could be entered. That would solve the problem of wanting to hide the actual URL and create your own linked text.
    ๐Ÿ™‚

    #17825
    momofone
    Participant

    @Amanda – Just wrap the custom field up <?php if….like I did here: http://i618.photobucket.com/albums/tt265/Nc3c45/calendarss3.jpg – if the custom field is not present it won't display it. Then you can add another custom field with plain text entry. I got that tested and working on a client's site that I am currently working on…

    #17832
    Jonah
    Participant

    Jacqui’s code should work for what you’re trying to accomplish Kym. Just check if the custom field has a value and if it doesn’t, display something else. You can achieve this with a standard if/else conditional statement.

    #17849
    Amanda Schnelle
    Participant

    Thank you all so much. Everyone was very helpful!!

    #17855
    Rob
    Member

    Superb. Happy to be of service, Amanda. If we can do anything else down the road just let us know.

    #929401
    Tim
    Participant

    The link is no longer in the posts above. Can you explain again how to do this with the latest version of The Events Calendar Pro?

    #929417
    Geoff
    Member

    Hi there, Tim! You should be able to echo custom fields using theย tribe_custom_field() function.

    This thread is fairly old, so I’m going to close it out. Please start a new thread if any other questions pop up and we’d be happy to help you there with a clean slate. ๐Ÿ™‚

    Cheers!
    Geoff

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Help with Additional Fields – links, and display on Event List page’ is closed to new replies.