Just hook your callback into admin_print_styles, i.e.:
add_action( 'admin_print_styles', 'mytheme_add_init' );
Alternately, you could add an is_admin() conditional wrapper inside your callback, and hook into wp_enqueue_scripts:
function mytheme_add_init() {
if ( is_admin() ) {
$file_dir=get_bloginfo('template_directory');
wp_enqueue_style("functions", $file_dir."/scripts/custom.css", false, "1.0", "all");
wp_enqueue_script("rm_script", $file_dir."/scripts/custom.js", false, "1.0");
}
}
add_action( 'wp_enqueue_scripts', 'mytheme_add_init' );
But the absolute best approach is to hook into your Theme’s admin page, via admin_print_styles-appearance_page_{pagename}:
add_action( 'admin_print_styles-appearance_page_{pagename}', 'mytheme_add_init', 11 );
This is a custom hook specifically for your appearance page, as defined via your add_theme_page() call.
Related Posts:
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Replacing Scripts in Admin Load_Scripts
- How to load library scripts in admin from plugins in noConflict wrapper?
- Enqueue script globally
- How can I add an image upload field directly to a custom write panel?
- ajaxurl not defined on front end
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to add a javascript snippet to the footer that requires jQuery
- How do i best handle custom plugin page actions?
- How to enqueue JavaScripts in a plugin
- How to include jQuery and JavaScript files correctly?
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- Export data as CSV in back end with proper HTTP headers
- Completely remove WP_Admin_Bar for specific user roles
- Load js/css files only on specific admin UI pages
- Get list of scripts / styles and show file which enqueued them
- API to trigger prompt on leaving page
- Show message on wordpress admin dashboard
- jQuery in header or footer
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- Hook the Keydown Event in the TinyMCE Post Editor
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- how to use thickbox in admin?
- How do I conditionally enqueue script for CPT single post type with plugin?
- How do you create a custom edit.php / edit pages page
- Cancel post save
- Add a jQuery function to admin pages
- Where to enqueue stylesheets for plugin?
- Is it save to require plugin.php early to be able to use get_plugin_data() earlier?
- WP Cron doesn’t save or in post body
- Create a clickable name in WP_List_Table for Plugin Admin
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- URLs of plugin resources?
- When is it too late to call the action wp_enqueue_scripts?
- Use js script from one plugin in another plugin
- Problems with removing admin bar
- Script won’t load via plugin class
- Plugin Loading Scripts and Styles on Every Page – Even when not being used
- Check if I am in the Admin Panel (wp-admin)?
- How to add custom content under plugin row in WordPress admin plugin list?
- How to put placeholder text in the main post input area?
- Inserting JS snippet in the footer if there is no wp_footer?
- Can’t get JS code to work with shortcode
- How to load the plugin only when logged in?
- How do you output enqueued scripts to an admin page?
- How do I add a javascript file to all admin pages via a plugin?
- Multisite plugin development and wp_enqueue_script
- How to redirect to action on custom page within admin section
- is_page() function doesnt working
- WP AJAX is not working, always returns 0
- Add notification bubble notice in navigation using transients
- How to avoid loading same script twice?
- Can I individually style items in the backend widget list?
- add a class when login
- Add a panel to edit post
- Where should I put “run once” plugin pages?
- Using the default wordpress uploader inside plugin
- Enqueue scripts in footer
- Loading scripts with wp_register_script and wp_enqueue_script
- Modify users.php page to create page/post on button clicked
- Adding Dropbox dropin js using wp_enqueue_script
- Where to call wp_enqueue_script in a plugin with custom template?
- Issue plugin commands in admin settings page
- Any problem in using native jquery ajax style instead of using admin-ajax.php?
- maintaing consistent layout wordpress dashboard
- Programmatically modify an admin page UI of a WordPress site from my WordPress plugin
- Is there a way to ensure plugin script loads before another script?
- Problems with: manage_${post_type}_posts_columns
- Global State During an Admin Post
- conditionally load javascript & CSS for do_action() calls from plugin
- Render content after post title in wp-admin
- What stylesheets are available in core?
- On cliking add new post redirect user to a custom page first
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Prevent third party plugin’s admin page access based on user type
- How to add WordPress Admin “Insert Link” UI (searches through existing posts for URL) and functionality into a custom plugin?
- Is it possible to restrict all admin pages except theme customisation and storefront using plugin?
- Admin – Handle data before creating or updating a post, page or custom post
- How to enqueue or include json file to a plugin
- wp_filesystem put_contents issue with owner/group
- Password field is empty when using wp_signon();
- How can I replace content in the WP Admin area before an admin page is rendered?
- Using ReactJS in the WordPress admin for plugin development
- template_redirect or admin-ajax.php?
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- Show error message after exception handled
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- Issue with contextual help overwriting existing content
- Alternatives to DISALLOW_FILE_EDIT wp-config Constant? It Breaks Some Plugins
- How do I add a favicon that only shows during viewing of my plugin’s admin panel?
- How do I link to a php file in my plugin directory?
- WP Plugin Running before jQuery
- WordPress Admin Login Custom Logo
- wp_localize_script is not adding a global variable for javascript
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- should i be checking for jquery before enqueing it in a plugin
- How to create custom settings page for custom plugin
- 400 Bad Request, in wordpress theme development, wp_ajax
- Creating multiple wp_editer() text fields in for loop — the text/visual switch only works for first editor