Hooks needed – Custom Fields
This topic contains 6 replies, has 3 voices, and was last updated by boxportable 10 years, 8 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
October 15, 2014 at 12:49 pm #18428
I would like to request hooks to add custom fields for my directory listings.
Currently have 2 custom fields I made by editing core files and having to do these updates after each update is a pain.
Also if and when could I expect to see these hooks? Just so I know to hold off updating until that time or not.
October 15, 2014 at 12:58 pm #18431also on the topic of hooks, any idea when some sort of documentation would be available on this topic (ie; list of available hooks)?
I bought this plugin several months ago now and have yet to see any progress with documentation and having to search or ask on the forums every time I want to hook something is time consuming and to be honest a little annoying.
Also just noticed the feature request bit to the right there, so this will only be implement if its in there and voted as popular? Because that kind of contradicts the bit about hooks and actions here:
October 15, 2014 at 2:08 pm #18438Hey Boxportable, I just want to check in.
Why do you need hooks for custom fields? GeoDirectory offers custom field management built-in for each post type (including the default places), and will automatically add them to the forms if you set the options.
Additionally, there are functions (not hooks) that can be run one time (via a plugin or theme) to programmatically add them. I used this in my GT-Vouchers plugin.
While I agree that more hooks/filters are needed, and a list would be nice, so far I’ve found the custom fields options built in to work quite well.
October 15, 2014 at 5:36 pm #18480As Jeff said, there shouldn’t be any need for custom fields.
In any case, we would need a through description of what you need in order to create any new hooks.
Thx
October 23, 2014 at 10:46 am #19194Well this is all good to know perhaps if the documentation wasn’t so barren I would of known this :/ but based on what your saying its still not what I want.
The code I added is custom HTML / Javascript for opening hours and also a bit for extra listing images using the wordpress built in media browser instead of the one that comes with geodirectory as standard which seems to be just a simple browse for file popup window.
I had to add code into the following files;
– Admin_hooks_actions.php (declare the 2 fields for them to appear as drag / drop items)
– Custom_field_html.php (added them to the switch in here, needed to but nothing under them as code)
– Custom_fields_functions.php (the actual code and some script file hooks for what would render when in the add/edit listing page)Each time I update I need to go and update all these files which is somewhat annoying.
Not sure what you mean by (again documentation isn’t very populated):
“Additionally, there are functions (not hooks) that can be run one time (via a plugin or theme) to programmatically add them. I used this in my GT-Vouchers plugin.”October 23, 2014 at 2:21 pm #19233For your last point, there’s a function called
geodir_custom_field_save() in custom_fields_functions that you can run on the activation hook. It will permanently save your custom fields.
The structure of it’s array can be see in geodir_create_default_fields() in admin_db_install.php
Drop me an email at jeff at jeffrose dot ca if you need some help.
I’ve said before, the hooks & filters are not everywhere I want them yet, but for the most part I haven’t had to hack core. Except for overriding a template, but that’s built in too.
October 24, 2014 at 1:06 pm #19420Ah Jeff that sounds good and something I will definitely look into thanks for the help I appreciate it.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket