URL,style=>URL,inline=>true|false]. * * @return void */ public function enqueue( $args = false ) { if ( ! $args ) { return; } // Early exit if we've already enqueued our assets. if ( self::$enqueued ) { return; } $args = wp_parse_args( $args, [ 'script' => false, 'style' => false, 'inline' => false, ] ); $this->assets['script'] = $args['script']; $this->assets['style'] = $args['style']; $this->inline = $args['inline']; if ( $this->inline ) { add_action( 'wp_footer', [ $this, 'inline_assets' ] ); } else { add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_assets' ] ); } self::$enqueued = true; } /** * Inline assets. * * @access public * * @return void */ public function inline_assets() { if ( $this->assets['script'] ) { echo ''; } if ( $this->assets['style'] ) { echo ''; } } /** * Enqueue assets. * * @access public * * @return void */ public function enqueue_assets() { if ( $this->assets['style'] ) { wp_enqueue_style( $this->handle_prefix . '-style', get_theme_file_uri( $this->assets['style'] ), [], filemtime( get_theme_file_path( $this->assets['style'] ) ) ); } if ( $this->assets['script'] ) { wp_enqueue_script( $this->handle_prefix . '-script', get_theme_file_uri( $this->assets['script'] ), [], filemtime( get_theme_file_path( $this->assets['script'] ) ), true ); } } /** * A wrapper for the wp_nav_menu function, adding our custom HTML for the expand/collapse button. * * @static * * @access public * * @param array $args The arguments to pass to wp_nav_menu(). * @param string|false $toggle_label The label for our toggle button. * @param string $nav_classes CSS classes to add to the