Home › Forums › Calendar Products › Events Calendar PRO › icons for additional fields.
- This topic has 11 replies, 2 voices, and was last updated 9 years ago by Brook.
-
AuthorPosts
-
January 4, 2015 at 3:29 pm #928546Lynden JonesParticipant
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?
January 5, 2015 at 11:58 am #928931BrookParticipantHello 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
January 5, 2015 at 1:14 pm #928971Lynden JonesParticipantHello 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.
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”
January 5, 2015 at 3:46 pm #929052BrookParticipantAhh 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
January 6, 2015 at 12:45 pm #929490Lynden JonesParticipantI 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.
January 6, 2015 at 12:46 pm #929491Lynden JonesParticipantThis reply is private.
January 6, 2015 at 1:14 pm #929504BrookParticipantThanks 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
January 11, 2015 at 11:51 am #931344Lynden JonesParticipantHi 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:
January 12, 2015 at 9:32 am #931593BrookParticipantThank 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
January 12, 2015 at 12:50 pm #931726Lynden JonesParticipantthank you – that’s perfect it has fixed it right up.
January 12, 2015 at 11:44 pm #931875BrookParticipantYou 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
May 13, 2015 at 11:42 pm #962516BrookParticipantSince 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
-
AuthorPosts
- The topic ‘icons for additional fields.’ is closed to new replies.