# add\_js

### add\_js

ClipBucket has a very useful function that is used to add Js file in ClipBucjet template so that you dont need to add js file in each template seperately, all you have to do is to add a little code and your file will be included in all templates

usage

add\_js(array\[]);

explanation

array(“file”=>”scope”);

file

Make sure your file is placed in /js directory, e.g if you want to call my.js , you first place it in /js directory and then add array(“my.js”=>”watch\_video”); , similarly if your file in /js/somefolder/myfile.js , you will add it array(“somefolder/myfile.js”=>”watch\_video”);

scope

scope basically tells the clipbucket in which files we should include this file , ie , watch\_video, home, view\_channel etc…  or say for each **file\_name.php** scope name is file\_name. ok , if you add

array(“my.js”=>”watch\_video”); array(“my.js”=>”view\_channel”); array(“my.js”=>”view\_group”);

it will include my.js file in all these “watch\_video” , “view\_channel” and “view\_group” files..\
if you want to add my.js in all files, simply, call function as follow

array(“my.js”=>”global”);

![](https://clipbucket.com/docs/wp-content/plugins/wp-postratings/images/loading.gif)Loading...


---

# 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://docs.clipbucket.com/guides/functions/add_js.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.
