[wp-hackers] wp_register_script with mootools or private
javascript
Daiv Mowbray
daiv at daivmowbray.com
Sat Nov 8 16:12:55 GMT 2008
Hello All and Any,
Still trying to work out the wp_enqueue_script:
The following fails to load the javascript files completely.
I suspect that I'm missing something here.
I only want the scripts to load on the front side.
I want them registered so that they won't load if other plugin has
already loaded them.
I have looked at numerous items online ref this issue,
Thanx for your time.
function myClass(){
register_activation_hook(__FILE__, array(&$this,'my_init'));
wp_register_script('moocore', plugins_url('/myplugin/js/mootools-1.2-
core.js'), array(''), '');
wp_register_script('moomore', plugins_url('/myplugin/js/mootools-1.2-
more.js'), array('moocore'), '1.2');
add_action("init", array(&$this,'add_scripts'));
}
function add_scripts(){
if (function_exists('wp_enqueue_script')) {
wp_enqueue_script( 'moocore' );
wp_enqueue_script( 'moomore' );
}
}
On Nov 7, 2008, at 2:05 PM, Viper007Bond wrote:
> Yes, but only if you use wp_enqueue_script() in both plugins.
>
> On Fri, Nov 7, 2008 at 4:12 AM, Daiv Mowbray <daiv at daivmowbray.com>
> wrote:
>
>>
>> On Nov 7, 2008, at 9:35 AM, Viper007Bond wrote:
>>
>>
----------
Daiv Mowbray
daiv at daivmowbray.com
----------
More information about the wp-hackers
mailing list