css - What needs to be enqueued into WordPress to use the jQuery-ui ".accordion" function? -


i want use jquery-ui .accordion function in wordpress child theme. far i've:

  1. created js file in child theme directory , put in no-conflict mode: jquery(document).ready(function($) { $( "#accordion" ).accordion(); });
  2. enqueued script functions.php file: function mychild_scripts() { wp_enqueue_style( 'onepage-child-style', get_stylesheet_uri() ); wp_enqueue_script( 'onepage-child-accordion', get_stylesheet_uri() . '/js/accordion.js', array('jquery-ui-accordion', 'jquery'), 20150507, true );
  3. added add_action function: add_action( 'wp_enqueue_scripts', 'mychild_scripts' );

however, .accordion function dependent on jquery-ui.css. don't need include in enqueueing process? can find no documentation discusses inclusion of file - or whether it's part of wp core.

you can enqueue stylesheet in functions.php file. may (assuming file in theme directory, inside css folder).

function my_styles() {     wp_register_style( 'jquery-ui-style', get_template_directory_uri() . '/css/jquery-ui.css', 'all' );     wp_enqueue_style( 'jquery-ui-style' ); }  add_action( 'wp_enqueue_scripts', 'my_styles' ); 

here's some reference.


Comments