Link to business, skip search part
This topic contains 9 replies, has 4 voices, and was last updated by Paolo 7 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
October 28, 2017 at 9:46 pm #403071
Hi,
I need help with removing the search functionality from “Link to business” when registering events.
Instead, the selectlist here should simply be populated with whatever business the current user has registered as a gd_place -CPT.…every event needs to have a linked business and because there will almost always only be one gd_place -CPT business registered from each user, it seems illogical having to search for that every time a new event is registered.
Thanks!
October 30, 2017 at 10:30 am #403194Hi Anders,
This would be a customisation, but its a relatively small task, you would need to remove this action
add_action('geodir_event_business_fields_on_metabox', 'geodir_event_show_business_fields_html');
And then add your own to replace it, basically copy and rename this function geodir_event_show_business_fields_html() to fit your needs.
Thanks,
Stiofan
October 30, 2017 at 11:44 pm #403367Thank you Stiofan,
Think I´m pretty close to what I need, modifying geodir_event_show_business_fields_html
But could you please show me the correct way to place the function inside my child themes functions.phpThis is what I tried but didn’t work:
function init_custom_link_to_business() { remove_action('geodir_event_business_fields_on_metabox', 'geodir_event_show_business_fields_html'); add_action('geodir_event_business_fields_on_metabox', 'geodir_event_show_business_fields_html_custom'); } add_action('init', 'init_custom_link_to_business'); function geodir_event_show_business_fields_html_custom(){ echo 'Modified version of geodir_event_show_business_fields_html comes here'; }
October 31, 2017 at 9:23 am #403417Hello,
Please use the code snippets plugin. You can read more about it here:
https://wpgeodirectory.com/docs/useful-plugins/#snippets
Also, we have a section in the docs for other common code snippets that might help:
https://wpgeodirectory.com/docs/common-code-snippets/
Let us know how it works for you
October 31, 2017 at 10:15 am #403424Thank you Alex,
I have already setup my child theme for Directory starter where I have my customizations working really nice (nothing complicated). Are you recommending I should switch to that plugin?
…I have looked at the snippets page (and searched the forums) but haven´t found anything helping me with this.
From Stiofans tip (and the forums) I have been able to modify the geodir_event_show_business_fields_html -function into what I need. Now I just would like to know the correct way to hook, remove, and replace the function, grateful for help with thatThanks!
October 31, 2017 at 12:32 pm #403438Hello,
What you are requesting is a customization. Stiofan provided a hint in his response, to give you a start on it, or you can hire a developer to take it further.
Code snippets is a simple tool to manage your custom functions, and doesn’t replace the value of a child theme.
You can use the snippets plugin to add short snippets like that without the need to customize any other files.
I have seen one other member discuss this functionality in the past. You can make a feature request here: https://wpgeodirectory.com/requests/
Thanks!
October 31, 2017 at 7:50 pm #403553Thank you Alex,
I can see how Code snippets would be great with a custom child theme like Supreme.
But I´m using a basic child theme for Directory starter that I believe serve the same purpose?
Anyway I have the customization ready I just need help removing the parenttheme -function eodir_event_show_business_fields_htmlThanks!
October 31, 2017 at 10:45 pm #403564Hello,
as mentioned, that is a customization.
Here is the documentation on the function that we can provide.
November 2, 2017 at 9:36 am #403766Ok,
I figured out how to achieve what I needed.
This is what worked for me (for replacing geodir_event_show_business_fields_html -function)
add_filter( 'template_include', 'geodir_event_template_loader_custom',1); function geodir_event_template_loader_custom($template) { if(geodir_get_current_posttype() == 'gd_event'){ remove_action('geodir_before_detail_fields','geodir_event_show_business_fields_html',1); add_action('geodir_before_detail_fields','geodir_event_show_business_fields_html_custom',1); } return $template; } function geodir_event_show_business_fields_html_custom() { echo 'Modified version of the geodir_event_show_business_fields_html comes here'; }
Thanks!
November 2, 2017 at 5:38 pm #403826That’s good news Andres, thanks for letting us know and for sharing! 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket