Created
April 16, 2014 19:37
-
-
Save thadallender/10924480 to your computer and use it in GitHub Desktop.
Customize Localized Sell Media Text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function my_set_add_to_cart_button() { | |
| global $wp_scripts; | |
| $data = $wp_scripts->get_data( 'sell_media', 'data' ); | |
| if( !is_array( $data ) ) { | |
| $data = json_decode( str_replace( 'var sell_media = ', '', substr( $data, 0, -1 ) ), true ); | |
| } | |
| $data['added_to_cart'] = 'New Add Cart Button Text'; | |
| $wp_scripts->add_data( 'sell_media', 'data', '' ); | |
| wp_localize_script( 'sell_media', 'sell_media', $data ); | |
| } | |
| add_action( 'sell_media_scripts_hook', 'my_set_add_to_cart_button' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment