Avoid Geodirectory from loading on page

This topic contains 25 replies, has 3 voices, and was last updated by  lopesval@me.com 8 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #61445

    lopesval@me.com
    Expired Member
    Post count: 18

    Hello, is there any code i could add in the header of my pages to avoid that geodirectory loads on pages where it should not load?
    I have a search box on my frontpage, and if someone performs a search the person is redirected to the search page…
    Other plugins i have enabled are advanced search and multilocation…
    But on pages where geodirectory should not load at all, i get sometimes a pop-up asking if i want to share my location, i see also a bunch of code in the source view, and sometimes it trows an error as pop-up just saying “error”

    Please help me disable geodirectory on pages where it is not in use…

    Thanks

    #61477

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    adding the code provided here https://wpgeodirectory.com/support/topic/seems-not-to-work/#post-61243 in your theme’s functions.php file, should remove calls to GD scripts on all non GD pages.

    Let us know if that worked.

    Thanks

    #61478

    lopesval@me.com
    Expired Member
    Post count: 18

    Thank you! Will that affect pages where i have a widget with the search box?

    #61479

    Paolo
    Site Admin
    Post count: 31206

    Yes of course. If you want to stop loading GD on non GD pages, you will have to avoid using GD widgets or shortcodes on these pages.

    Thanks

    #61485

    lopesval@me.com
    Expired Member
    Post count: 18

    I added the code to functions.php but the javascript is still loading… Is that code working?

    #61486

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    please provide a link where we can verify and possibly wp admin credentials in a private reply (only staff can read them).

    Let us know,

    Thx

    #61487

    lopesval@me.com
    Expired Member
    Post count: 18
    This reply has been marked as private.
    #61495

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    please try this code instead:

    
    
    add_action( 'wp', 'wpdocs_dequeue_script', 100 );
    function wpdocs_dequeue_script() {
        if (!geodir_is_geodir_page()){
            remove_action('wp_enqueue_scripts', 'geodir_templates_scripts');
            remove_action('wp_enqueue_scripts', 'geodir_templates_styles', 8);  
        }
    }

    This will remove all scripts realted to the core plugin. This will remove the bulk.

    You may need another function for each add-on too if you want to remove those scripts too.

    If you give us the list of add-ons you have installed, we will provide the code.

    Thanks

    #61506

    lopesval@me.com
    Expired Member
    Post count: 18

    It looks like this code alone affects the GD pages too, images are not loading when i perform a search…

    I use Advanced Search
    Buddypress Integration
    Claim Manager
    Custom Post Types
    Location Manager
    Social Importer

    #61553

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    i added the code to your theme and search page still seems to load fine, can you let me know the exact url where you are seeing the problem?

    Stiofan

    #61583

    lopesval@me.com
    Expired Member
    Post count: 18

    I just saw the code you added, but it does not seem to work… The geodirectory javascript is till loading on all the pages… Did you see it?
    If you go to /location/me or press the “Around Me” button in the top menu, you will see that images of search results are not loading and the page is not loading correctly

    #61584

    lopesval@me.com
    Expired Member
    Post count: 18

    i just removed the code you added from the main theme and added it to the child theme…

    #61611

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    This was a problem with the location/me page not being recognised as a GD page, i have fixed this now.

    Thanks,

    Stiofan

    #61612

    lopesval@me.com
    Expired Member
    Post count: 18

    Oh… thank you… But why is the javascript still loading on all pages?

    #61615

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    which Javascript are you talking about and on which page do you see it loading?

    Please let us know,

    Thanks

Viewing 15 posts - 1 through 15 (of 26 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket