Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress Custom Plug (how to call multiple javascript files)
    primarykey
    data
    text
    <p>I decided to try to create a plugin that calls forth a couple of javascript files and a css file using the Wordpress Plugin Generator. It is working somewhat - it's calling one of the javascript files but not the other two.</p> <p>I am using the wp_enqueue_script function, but probably wrong. Any help would be greatly appreciated!</p> <pre><code>&lt;?php /* Plugin Name: Tab Header Code Plugin URI: [insert the plugin uri here] Description: Inserts appropriate javascript and css libraries for tabs Author: Jesse Wallace Version: 0.1 Author URI: http://www.enticent.com Generated At: www.wp-fun.co.uk; */ if (!class_exists('tabstyles')) { class tabstyles { /** * PHP 4 Compatible Constructor */ function tabstyles(){$this-&gt;__construct();} /** * PHP 5 Constructor */ function __construct(){ add_action("init", array(&amp;amp;$this,"add_script1")); add_action("init", array(&amp;amp;$this,"add_script2")); add_action("init", array(&amp;amp;$this,"add_script3")); add_action("wp_head", array(&amp;amp;$this,"add_css")); } /** * Tells WordPress to load the scripts */ function add_script1(){ wp_enqueue_script('tab_header_code_script1', '/wp-content/plugins/tab-header-code/js/tabview-min.js', NULL , 0.1); } function add_script2(){ wp_enqueue_script('tab_header_code_script2', '/wp-content/plugins/tab-header-code/js/element-min.js', NULL , 0.1); } function add_script3(){ wp_enqueue_script('tab_header_code_script3', '/wp-content/plugins/tab-header-code/js/yahoo-dom-event.js', NULL , 0.1); } /** * Adds a link to the stylesheet to the header */ function add_css(){ echo '&lt;link rel="stylesheet" href="'.get_bloginfo('wpurl').'/wp-content/plugins/tab-header-code/css/tabstyle.css" type="text/css" media="screen" /&gt;'; } } } //instantiate the class if (class_exists('tabstyles')) { $tabstyles = new tabstyles(); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload