Avoid Geodirectory from loading on page
This topic contains 25 replies, has 3 voices, and was last updated by [email protected] 9 years, 10 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
November 25, 2015 at 12:54 pm #61445
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
November 25, 2015 at 5:25 pm #61477Hi,
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
November 25, 2015 at 5:30 pm #61478Thank you! Will that affect pages where i have a widget with the search box?
November 25, 2015 at 5:31 pm #61479Yes 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
November 25, 2015 at 5:48 pm #61485I added the code to functions.php but the javascript is still loading… Is that code working?
November 25, 2015 at 6:02 pm #61486Hi,
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
November 25, 2015 at 6:06 pm #61487This reply has been marked as private.November 25, 2015 at 6:57 pm #61495Hi,
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
November 25, 2015 at 7:42 pm #61506It 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 ImporterNovember 26, 2015 at 12:04 pm #61553i 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
November 26, 2015 at 5:13 pm #61583I 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 correctlyNovember 26, 2015 at 5:15 pm #61584i just removed the code you added from the main theme and added it to the child theme…
November 26, 2015 at 7:03 pm #61611This was a problem with the location/me page not being recognised as a GD page, i have fixed this now.
Thanks,
Stiofan
November 26, 2015 at 7:05 pm #61612Oh… thank you… But why is the javascript still loading on all pages?
November 26, 2015 at 7:31 pm #61615Hi,
which Javascript are you talking about and on which page do you see it loading?
Please let us know,
Thanks
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket