GeoDirectory Support Forums Forums GeoDirectory Jobs Link to business, skip search part

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #403071

    anders
    Full Member
    Post count: 37

    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!

    #403194

    Stiofan OConnor
    Site Admin
    Post count: 21069

    Hi 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

    #403367

    anders
    Full Member
    Post count: 37

    Thank 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.php

    This 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';
    }
    #403417

    Alex
    Moderator
    Post count: 7362

    Hello,

    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

    #403424

    anders
    Full Member
    Post count: 37

    Thank 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 that

    Thanks!

    #403438

    Alex
    Moderator
    Post count: 7362

    Hello,

    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!

    #403553

    anders
    Full Member
    Post count: 37

    Thank 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_html

    Thanks!

    #403564

    Alex
    Moderator
    Post count: 7362

    Hello,

    as mentioned, that is a customization.

    Here is the documentation on the function that we can provide.

    https://wpgeodirectory.com/codex/codex/geodirectory-events_functions/geodir_event_show_business_fields_html/

    #403766

    anders
    Full Member
    Post count: 37

    Ok,

    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!

    #403826

    paolo
    Site Admin
    Post count: 28930

    That’s good news Andres, thanks for letting us know and for sharing! 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Link to business, skip search part’ is closed to new replies, this may be for inactivity, please open a new topic if you have a similar question.

  • How to add a new support ticket

    To open a new support ticket, first select the relevant forum and then click the "New Post" button. Example: You need support for the core plugin? Click on GeoDirectory Core Plugin support and click on the "New Post Button".
  • Support Policy

    Please read the support policy before starting to use the forum.
  • Feature Requests

    Is there a theme for which you'd like to see a compatibility package or a new feature that you think would be of great benefit for the GeoDirectory community?

    Submit a feature request : here

    Each month you get 5 votes to distribute. You can choose to use all your votes for one idea you really like, or spread them across between several ideas :)

    We will do our best to create whatever you suggest if it becomes popular, we however reserve the right to reject ideas that we believe could not be realized without revolutionizing the plugin.

  • Are you a developer?

    Make Money with GD Jobs

    Get listed in the GeoDirectory Experts Directory. There may be a new client waiting for your services.
  • Looking for a GD developer?

    We do not provide customization services, but feel free to check out the GeoDirectory Experts Directory, there you'll find several freelance GD experts ready to start working with you.