Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For styles <code>wp_register_style( 'namespace', 'http://locationofcss.com/mycss.css' );</code></p> <p>Then use: <code>wp_enqueue_style('namespace');</code> wherever you want the css to load. </p> <p>Scripts are as above but the quicker way for loading jquery is just to use enqueue loaded in an init for the page you want it to load on: <code>wp_enqueue_script('jquery');</code></p> <p>Unless of course you want to use the google repository for jquery.</p> <p>You can also conditionally load the jquery library that your script is dependent on:</p> <p><code>wp_enqueue_script('namespaceformyscript', 'http://locationofscript.com/myscript.js', array('jquery'));</code></p> <p><strong>Update Sept. 2017</strong></p> <p>I wrote this answer a while ago. I should clarify that the best place to enqueue your scripts and styles is within the <code>wp_enqueue_scripts</code> hook. So for example:</p> <pre><code>add_action('wp_enqueue_scripts', 'callback_for_setting_up_scripts'); function callback_for_setting_up_scripts() { wp_register_style( 'namespace', 'http://locationofcss.com/mycss.css' ); wp_enqueue_style( 'namespace' ); wp_enqueue_script( 'namespaceformyscript', 'http://locationofscript.com/myscript.js', array( 'jquery' ) ); } </code></pre> <p>The <code>wp_enqueue_scripts</code> action will set things up for the "frontend". You can use the <code>admin_enqueue_scripts</code> action for the backend (anywhere within wp-admin) and the <code>login_enqueue_scripts</code> action for the login page.</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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