Advertisement
designbymerovingi

enqueue mycred send script

Jan 5th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. add_action( 'mycred_front_enqueue', 'mycred_pro_enqueue_mycred_send' );
  2. function mycred_pro_enqueue_mycred_send() {
  3.  
  4. if ( is_user_logged_in() && is_single() ) {
  5.  
  6. $mycred = mycred();
  7. $base = array(
  8. 'ajaxurl' => admin_url( 'admin-ajax.php' ),
  9. 'token' => wp_create_nonce( 'mycred-send-points' )
  10. );
  11.  
  12. $language = apply_filters( 'mycred_send_language', array(
  13. 'working' => esc_attr__( 'Processing...', 'mycred' ),
  14. 'done' => esc_attr__( 'Sent', 'mycred' ),
  15. 'error' => esc_attr__( 'Error - Try Again', 'mycred' )
  16. ) );
  17. wp_localize_script(
  18. 'mycred-send-points',
  19. 'myCREDsend',
  20. array_merge_recursive( $base, $language )
  21. );
  22. wp_enqueue_script( 'mycred-send-points' );
  23.  
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement