Add condition in tootilp for additional field

Home Forums Calendar Products Events Calendar PRO Add condition in tootilp for additional field

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1580089
    jpp
    Participant

    Hello,

    I added several more fields in tooltips. for that, I added the following code in single-event.php:

    $ fields = my_tribe_get_custom_fields ($ post-> ID);
    
    foreach ($ fields like $ k => field $) {
    
    if (strpos ($ k, 'Reserved')! == false) {
    $ additional_data ['reservea'] = $ field;
    }
    
    if (strpos ($ k, 'color')! == false) {
    $ additional_data ['belt'] = $ field;
    }
    
    } 

    And the following code in tooltip.php:

    [[if (reservea.length) {]]
    Reserved for: [[= raw reservea]]
    [[}]]
    [[if (belt.length) {]]
    Belt color: [[= belt]]
    [[}]] 

    but if the event does not have the 2 additional fields then the following error appears:

    Uncaught TemplateError: ReferenceError: the belt is not defined (on line 24 of tribe_tmpl_tooltip_featured)

    How can I fix it?

    Thank you for your help

    #1581314

    Thanks so much for reaching out!

    After reviewing your request this essentially looks like a custom development task and so is outside of our stated scope of support.

    With that being said, we’d love to help point you in the right direction.

    I’d recommend starting off by taking a look at our Themer’s Guide, which can show you which templates can be edited and copied in order to attempt the results that you are looking for.

    If you’d prefer not to tackle this customization on your own, we may be able to assist you further. We do need to prioritize support requests from other customers at this time but I’ll certainly flag this with the team and – although we can’t make any promises – if we have time and space to come back and help, we’ll be happy to do so.  Please let us know if you’d like to go this route so that you can be added to this queue.

    In the meantime, if there is any more information you can share (including mocks) that will help us to better understand what you are seeking please do feel free to add them to this ticket.

    If you urgently need help with this, however, you may instead wish to consider working with a suitably skilled developer or designer who can offer the additional level of support you require.

    Let me know if you have any other questions on this topic!

     

    Thanks,

    Jaime

    #1597153
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Add condition in tootilp for additional field’ is closed to new replies.