Martti Laine
Martti Laine

Reputation: 12985

Add custom js to add functionality to themes options-page on Wordpress admin-panel?

I have a theme, which has a options-page. I need to create tabs for it, so I need to include my custom js-file.

I've tried this:

function add_js() {
    echo '<script type="text/javascript" src="'.get_bloginfo('template_url').'/options/js.js'.'"></script>';
}

add_action('wp_head','add_js');

However, this obiviously adds the script to the blog itself, but not the admin-panel. How to include this js-file only in options-page?

Thanks, Martti Laine

Upvotes: 0

Views: 1122

Answers (1)

t31os
t31os

Reputation: 2558

Might i refer you to to the following WPSE topic.
https://wordpress.stackexchange.com/questions/2073/including-css-and-js-on-admin-screen-of-custom-theme-options

Hope that helps.

Upvotes: 1

Related Questions