I have written 2 wordpress plugins and both use jquery 1.6. I load the plugin using the following code.
Plugin 1
function sheader() {
$plugin_dir = WP_PLUGIN_URL . "/";
?>
<script type="text/javascript" src="<?php echo $plugin_dir; ?>isearch/js/jquery-1-6.js" ></script>
<?php
}
add_action('wp_head', 'sheader');
Plugin 2
function nheader() {
$plugin_dir = WP_PLUGIN_URL . "/";
?>
<script type="text/javascript" src="<?php echo $plugin_dir; ?>isearch/js/jquery-1-6.js" ></script>
<?php
}
add_action('wp_head', 'nheader');
Since i am using the same file in both plugins, plgin 1 does not work. when i deactivate plugin 2 it works properly.
How can i solve this issue ??
The way you include jquery, it includes the possibility to load it twice! Since most other plugins use the enque api. Make sure to use wp_enqueueto include any jquery dependency. It will check if it is allready loaded.
Code is taken from my plugin:
http://wordpress.org/extend/plugins/facebook-page-promoter-lightbox/