icons for additional fields.

Home Forums Calendar Products Events Calendar PRO icons for additional fields.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #928546
    Lynden Jones
    Participant

    Previously you helped me out with displaying icons for fields.
    https://theeventscalendar.com/support/forums/topic/icons-for-additional-fields/

    These worked great but there has been a depreciation and now they are not working anymore.

    Notice: tribe_get_custom_field is deprecated since version 3.9!
    Use tribe_get_custom_fields instead.

    I changed my code to tribe_get_custom_fields but now I just get the word “array” instead of the field and icon.

    Can you offer me a suggestion?

    #928931
    Brook
    Participant

    Hello amandaveeenhuis,

    Interesting. In the thread you linked it does not use that function at all. I just double checked and that code it still working, it adds a class called option-1 to the proper element.

    I am seeing that error on your site however. It is possible that your theme needs to be updated to be compatible with 3.9. To figure what needs updating, you could try a conflict test. In the mean time simply setting WP_DEBUG to false in your wp-config.php file should hide notices like that. Those are not meant to be shown on live sites, only testing/development sites.

    Does that all make sense? If you’re able to find a conflict, was it your theme?

    – Brook

    #928971
    Lynden Jones
    Participant

    Hello Brook

    I missed turning off the debug so I have deactivated it now. Thank you for pointing this out.
    I also have run the Theme Check plugin over the theme to look at any problems and depreciation. I have fixed any little things that came up.

    In my link I didn’t add the exact page that was having an issue.

    Theatre For Children

    Because I am calling a special item that is written in my theme’s function file it is not going to show up when switching themes to test for problems. I have deactivated all plugins except for events calendar but the page still only shows – “Array”

    #929052
    Brook
    Participant

    Ahh that makes a bit more sense. The JS code mentioned in that other thread is definitely not the source of your error as the “Array”s still appear with JS disabled. It is quite likely that the code you have in your functions file is what’s causing that error. Could you share a copy of it, maybe on pastebin or as a gist? I can not guarantee that I can fix it because that is definitely outside our scope of support. But I’d happily take a look and see if I have any pointers.

    Cheers!

    – Brook

    #929490
    Lynden Jones
    Participant

    I was given the code by one of your support people.
    It is listed in this thread – https://theeventscalendar.com/support/forums/topic/icons-for-additional-fields/

    Here is the copy from my functions file.

    #929491
    Lynden Jones
    Participant

    This reply is private.

    #929504
    Brook
    Participant

    Thanks for putting it on gist. I evidently was not clear enough before though. I am rather certain that code is not the problem. You can test this by commenthing this line of your functions.php:

    add_action( 'wp_footer', 'options_add_javascript' );

    to this:

    //add_action( 'wp_footer', 'options_add_javascript' );

    That stops the code from running. I believe you will continue to see the Array issue even without that code running. It is likely another piece of code that is causing this problem. Do you have any other customizations? If you switch themes does it go away? — I know you’ve said you think it will, and I agree, but it never hurts to confirm if you have the time. If you’ve narrowed it to the theme, any idea what code inside of it is the problem assuming it’s not the above?

    Cheers!

    – Brook

    #931344
    Lynden Jones
    Participant

    Hi Brook

    If I comment out that line from Functions.php you are right it will still show up array but that is because in the template it is calling the array to be output.

    The call in my template file is:

    https://gist.github.com/blackcat1975/97658568fe7cdaf6a5c6

    #931593
    Brook
    Participant

    Thank you for sharing that code. That is definitely the culprit. Simply change you calls from:

    tribe_get_custom_fields('Label Name')

    to:

    TribeEventsCustomMeta::get_custom_field_by_label('Label Name')

    Does that work? Is there  anything else I can answer or clarify? Please let me know. Thanks Amanda!

    – Brook

    #931726
    Lynden Jones
    Participant

    thank you – that’s perfect it has fixed it right up.

    #931875
    Brook
    Participant

    You are welcome Amanda!

    By the way I just learned from our lead dev that even that method I showed you might break in a future version. Should that happen, the function tribe_get_custom_fields() without the trailing s should continue to work and not show deprecation notices. However, since it returns an array you will need to select one of its children keys. You could run it through a var_dump to get the right key for your relevant information.

    I apologize, I was a bit confused earlier. I though both tribe_get_custom_field() and tribe_get_custom_fields() were being deprecated or else I would have mentioned this then.

    Just fair warning about the possible upcoming change. No need to try out the other method right now unless you want to future proof your site. Let me know if you need anything else. Cheers!

    – Brook

    #962516
    Brook
    Participant

    Since this topic has gone for a spell without an update I am going to archive it. If you do need further assistance, please feel free to open another topic. We would love to help.

    – Brook

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘icons for additional fields.’ is closed to new replies.