add_filter( 'gettext', 'theme_change_comment_field_names', 20, 3 );
/**
* Change comment form default field names.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function theme_change_comment_field_names( $translated_text, $text, $domain ) {
if ( is_singular() ) {
switch ( $translated_text ) {
case 'Name' :
$translated_text = __( 'First Name', 'theme_text_domain' );
break;
case 'Email' :
$translated_text = __( 'Email Address', 'theme_text_domain' );
break;
}
}
return $translated_text;
}
add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' );
add_filter( 'woocommerce_checkout_fields' , 'remove_checkout_fields' );
function remove_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_email']);
unset($fields['account']['account_username']);
unset($fields['account']['account_password']);
unset($fields['account']['account_password-2']);
return $fields;
}
function my_script() {
if ( is_page('contacts') )
wp_enqueue_script('my-script','http://maps.api.2gis.ru/2.0/loader.js?data-id');
}
add_action( 'wp_enqueue_scripts', 'my_script' );
add_filter('clean_url','unclean_url',10,3);
function unclean_url( $good_protocol_url, $original_url, $_context) {
if ( false !== strpos( $original_url, 'data-id' ) ) {
remove_filter( 'clean_url', 'unclean_url', 10, 3 );
$url_parts = parse_url( $good_protocol_url );
return $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'] . '?pkg=full&lazy=true'."' data-id='dgLoader";
}
return $good_protocol_url;
}