[Plugin: climate change glossary] Javascript and configuration errors
-
After installing the plugin, I found that a javascript error within the climate-change-glossary/js/script.js file was having an affect on other files.
The original file was performing an action on a HTML element of ID #pp_thesaurus_input_term. This only exists on the glossary page, rather than other pages on the site. To avoid this error I surrounded the action in an if statement, for example:
if ($("#pp_thesaurus_input_term").length ) { $("#pp_thesaurus_input_term").clearField().autocomplete(pp_thesaurus_suggest_url, { minChars: 2, matchContains: true, cacheLength: 10, max: 15, scroll: false }).result(function (event, item) { location.href = item[1]; }); }
Our WordPress deployment might be structured differently from most installed, but this was causing a problem with the glossary AJAX. On our site we have a current folder and then a deployments folder. The current folder points to the latest deployment, making it very quick to switch between versions with very little downtime. The configuration file is linked to a shared folder. Unfortunately this does cause a problem when loading the wp-config.php within the plugin.
Our folder structure is something like:
current – link to most recent deploymentreleases – 201201031518/
– 2011122031518/shared – uploads/
– wp-config.phpTo resolve the problem we ensured the ABSPATH global variable was set before loading the wp-config.php, this ensured the the wp-settings.php and other core files could be loaded.
This change was added to the pp-thesaurus-autocomplete.php file and consisted of the following code:
if ( !defined('ABSPATH') ) define('ABSPATH', $sPath . '/'); require_once($sPath.'/wp-config.php');
Would it be possible to make changes to the plugin to help resolve the aforementioned issues?
Thank-you for creating such a useful plugin.
- The topic ‘[Plugin: climate change glossary] Javascript and configuration errors’ is closed to new replies.