# 3 (load library theme-scripts.js) (ok)

![](/files/-M9akszblZwucJcV2sb3)

![](/files/-M9akywWmYMbaM2mKoj-)

![](/files/-M9al0C3SloImKaf33KP)

![](/files/-M9al2awikRguvP07GDk)

![](/files/-M9al4hU4e6tQBDDpDRe)

![](/files/-M9al7I3l3cRqys_igGm)

```
// Lionel Load file js && css
define( 'PFCOREELEMENTSURLPUBLIC', get_template_directory_uri().'/public/' );
require get_parent_theme_file_path( '/coreelements-public.php' );
require get_parent_theme_file_path( '/coreelements-loader.php' );
require get_parent_theme_file_path( '/coreelements.php' );
```

```
<?php
class Coreelements_Public {
  public function enqueue_styles_scripts() {
    wp_register_script('theme-scriptspf', PFCOREELEMENTSURLPUBLIC . 'js/theme-scripts.js', ['jquery', 'jquery-ui-autocomplete'], '2.0', true);
    wp_enqueue_script('theme-scriptspf');
  }
}
?>
```

```
<?php
class Coreelements_Loader {
  protected $actions;
  public function __construct() {
    $this->actions = array();
  }
  public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
    $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
  }
  private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) {
    $hooks[] = array(
      'hook'          => $hook,
      'component'     => $component,
      'callback'      => $callback,
      'priority'      => $priority,
      'accepted_args' => $accepted_args,
    );
    return $hooks;
  }
  public function run() {
    foreach ($this->actions as $hook) {
      add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
    }
  }
}
?>
```

```
<?php
class Coreelements {
  protected $loader;
  public function __construct() {
  	$this->load_dependencies();
  	$this->define_public_hooks();
  }
  private function load_dependencies() {
  	$this->loader = new Coreelements_Loader();
  }
  private function define_public_hooks() {
  	$plugin_public = new Coreelements_Public();
  	$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles_scripts' );
  }
  public function run() {
		$this->loader->run();
	}
}
$plugin = new Coreelements();
$plugin->run();
?>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learnphp.gitbook.io/learnphp/wordpress/3-load-library-theme-scripts.js-ok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
