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
add_filter( 'the_content', 'artabr_remove_alight_class_img', 5 ); | |
function artabr_remove_alight_class_img( $content ) { | |
$alightimg = " | |
<script type='text/javascript'> | |
jQuery(document).ready(function ($){ | |
$('.entry p img').removeClass('alignleft'); | |
$('.entry p img').removeClass('alignnone'); | |
$('.entry p img').addClass('aligncenter'); | |
}); | |
</script> |
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
add_filter('the_content', 'the_content_replace_tags', 10, 20); | |
function the_content_replace_tags($content){ | |
$patterns = array("#(<img.*title=\")[^\"]*(\"[^>]*>)#", "#(<img.*alt=\")[^\"]*(\"[^>]*>)#"); | |
$replacements = array("\\1\\2", "\\1\\2"); | |
$content = preg_replace($patterns, $replacements, $content); | |
return $content; | |
} |
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
add_filter( 'woocommerce_cart_totals_coupon_label', 'kld_cart_totals_coupon_html_label', 10, 3 ); | |
function kld_cart_totals_coupon_html_label( $coupon_text, $coupon ) { | |
if ( is_string( $coupon ) ) { | |
$coupon = new WC_Coupon( $coupon ); | |
} | |
$coupon_text .= ' ' . $coupon->get_amount() . '%'; | |
return $coupon_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
add_action( 'woocommerce_product_options_dimensions', 'wc_custom_add_custom_fields' ); | |
function wc_custom_add_custom_fields() { | |
global $post; | |
// Print a custom text field | |
woocommerce_wp_text_input( array( | |
'id' => '_color_crown', | |
'label' => 'Цвет', | |
'description' => '', | |
'desc_tip' => 'true', | |
'placeholder' => 'Цвет', |
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
add_filter( 'woocommerce_checkout_fields', 'kld_checkout_fields' ); | |
function kld_checkout_fields( $fields ) { | |
unset( $fields['billing']['billing_company'] ); | |
unset( $fields['billing']['billing_address_2'] ); | |
return $fields; | |
} |
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
add_action( 'woocommerce_cod_icon', 'kld_checkout_payment_cod_add_icon', 20 ); | |
function kld_checkout_payment_cod_add_icon( $icon ) { | |
$icon = 'https://korolandia.space/wp-content/uploads/2017/05/sell-cash-icon.png'; | |
return $icon; | |
} |
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 artabr_header_card_count() { | |
global $woocommerce; | |
$count = $woocommerce->cart->get_cart_contents_count(); | |
//$count = get_cart_contents_count(); | |
?> | |
<a class="cart-link" href="<?php echo wc_get_cart_url(); ?>" title="Смотреть корзину"> <span |
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
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 ); | |
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) { | |
global $product; | |
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) { | |
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">'; | |
$html .= woocommerce_quantity_input( array(), $product, false ); | |
$html .= sprintf( '<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s">%s</a>', | |
esc_url( $product->add_to_cart_url() ), | |
esc_attr( isset( $quantity ) ? $quantity : 1 ), | |
esc_attr( $product->get_id() ), |
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
add_action( 'mobile_cart', 'artabr_header_card' );// хук должен быть где-то в шапке или просто функцию выводите в нужном месте | |
function artabr_header_card() { | |
global $woocommerce; | |
$count = $woocommerce->cart->get_cart_contents_count(); | |
//$count = get_cart_contents_count(); | |
?> | |
<a class="cart-link" href="<?php echo wc_get_cart_url(); ?>" title="Смотреть корзину"> | |
<!--<span class="dashicons dashicons-cart"></span>--> | |
<?php if ( $count > 0 ) : ?> |
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
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
if ( ! class_exists( 'WC_Settings_MyPlugin' ) ) : | |
function my_plugin_add_settings() { | |
/** | |
* Settings class | |
* | |
* @since 1.0.0 | |
*/ | |
class WC_Settings_MyPlugin extends WC_Settings_Page { | |