WordPress Enqueud Files

  • JavaScript and CSS files should be enqueued via functions.php
  • Best Practice: Combine all enqueued styles and scripts into a single function.
    • wp_enqueue_script()
      • syntax: wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
        • $in_footer = boolean, place javascript in footer instead of header?
      • ex.: wp_enqueue_script( ‘comment-reply’ );
    • wp_enqueue_style()
      • syntax: wp_enqueue_style( $handle, $src, $deps, $ver, $media);
        • $handle = name of stylesheet; $src = location; $deps = dependency; $ver = version; $media = all, screen, print, handheld
      • ex. wp_enqueue_style( ‘style’, get_stylesheet_uri() );