add css and javascript file to admin in wordpress theme

WordPress Tutorial, add css and javascript file to admin in wordpress theme. Many developers want to add the javascript and css files into wordpress themes.

add css and javascript file to admin in wordpress theme

You just need to add following code into functions.php file.

// Register your javascript for properties
function admin_your_javascript(){
    global $post;
    if($post->post_type == 'post-type' && is_admin()) {
        wp_enqueue_script('YOUR-JS', WP_CONTENT_URL . '/themes/YOUR-THEME/js/YOUR-JS.js');

    }
}
add_action('admin_print_scripts', 'admin_your_javascript');

// Register your styles for properties
function admin_your_styles(){
    global $post;
    if($post->post_type == 'post-type' && is_admin()) {
        wp_enqueue_style('YOUR-CSS', WP_CONTENT_URL . '/themes/YOUR-THEME/css/YOUR-CSS.css');
    }
}
add_action('admin_print_styles', 'admin_your_styles');

You just need to replace Your theme name and javascript and css file name.

add css and javascript file to admin in wordpress theme
add css and javascript file to admin in wordpress theme

compress javascript and css files

Many times we are searching for Javascript and css compression. So here we collected some great web resources which are useful for compress javascript and CSS files.

Use following steps to compress javascript and css files

Few days before i was searching for Jquery JS library compression.

compress javascript and css files
compress javascript and css files

Yes there is compressed version available but i want to make some changes in JS files as per my project requirements.
So i want to compress my JS and CSS files without getting any error.
YUI Compressor 2.4.2. is the very nice tool for that. But i dont want to spend time on how YUI compressor is working.

So here is solution- I got online YUI compressor.
You can use that:
http://refresh-sf.com/yui/
It has very nice options.

http://compressor.ebiene.de/

http://www.cssdrive.com/index.php/main/csscompressor