Hey, >From what I have learned about including javascript and/or css within plugins you should not use the wp_head function, but rather the wp_enqeue_script function. Here is the new block of code that allows us to put your previous javascript back into an external file.
function CatSync_Admin() { include("adminMenu.php"); } function load_js() { $plugindir = get_settings('home').'/wp-content/plugins/'.dirname(plugin_basename(__FILE__)); wp_enqueue_script('loadjs', $plugindir . '/includes/ajaxScript.js'); } function CatSync_Menu() { add_management_page("CatSync", "CatSync", 1, "CatSync", "CatSync_Admin"); } add_action("admin_menu", "CatSync_Menu"); add_action( "admin_print_scripts", 'load_js' ); I suggest you pull the latest version of the code to see how it all works. I have not made any changes since before the holidays and I will not have a chance to really work on it for another couple of days. I hope this helps. Mike On Sat, Dec 26, 2009 at 10:38 AM, Vaibhav Gupta < vaibhavgupta_i...@yahoo.co.in> wrote: > Hey guys, > > Sorry I have been busy with my work at office and also looking for a job > change. I have one basic doubt in WP plugin development. I was trying the > following code in CatSync.php: > > add_action("admin_menu", "CatSync_Menu"); > add_action("wp_head", "headerfunction"); > function headerfunction() > { > echo "<script>alert();</script>"; > } > > I am expecting a script tag to be included in the header. But this does not > seem to work. Does anyone have any suggestion? > > And by the way belated Merry Christmas. > > Regards, > Vaibhav > > ------------------------------ > The INTERNET now has a personality. YOURS! See your Yahoo! > Homepage<http://in.rd.yahoo.com/tagline_yyi_1/*http://in.yahoo.com/> > . > > _______________________________________________ > Mailing list: > https://launchpad.net/~catsync-devs<https://launchpad.net/%7Ecatsync-devs> > Post to : catsync-devs@lists.launchpad.net > Unsubscribe : > https://launchpad.net/~catsync-devs<https://launchpad.net/%7Ecatsync-devs> > More help : https://help.launchpad.net/ListHelp > >
_______________________________________________ Mailing list: https://launchpad.net/~catsync-devs Post to : catsync-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~catsync-devs More help : https://help.launchpad.net/ListHelp