Advertisement
citstudio

Adding Custom JS on WP Admin

Sep 20th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. // download plugin from http://keith-wood.name/maxlength.html
  2.  
  3. // yourthemes/functions.php
  4. function load_custom_wp_admin_style() {
  5.         wp_register_style( 'maxlength', get_template_directory_uri() . '/js/maxlength/jquery.maxlength.css', false, '1.0.0' );
  6.         wp_enqueue_style( 'maxlength' );
  7.     wp_enqueue_script('maxlength-plugin', get_template_directory_uri() . '/js/maxlength/jquery.plugin.min.js', array(), '', true);
  8.     wp_enqueue_script('maxlength-core', get_template_directory_uri() . '/js/maxlength/jquery.maxlength.min.js', array(), '', true);
  9.     wp_enqueue_script('maxlength-options', get_template_directory_uri() . '/js/maxlength/maxlength-options.js', array(), '', true);
  10. }  
  11. add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );   
  12.  
  13. // yourthemes/js/maxlength/maxlength-options.js
  14. jQuery(document).ready(function() { jQuery('#excerpt').maxlength({max: 250}); });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement