appearance: none;
(не забудьте про вендорные префиксы). function woo_login_redirect( $redirect_to ) {
$redirect_to = wc_customer_edit_account_url();
return $redirect_to;
}
add_filter( 'woocommerce_login_redirect', 'woo_login_redirect' );
/**
* Always redirect user to "Edit Account" page after login.
*
* @return string Target URL
*/
function woo_login_redirect()
{
return wc_customer_edit_account_url();
}
add_filter( 'woocommerce_login_redirect', 'woo_login_redirect' );
/**
* Always redirect user to "Edit Account" page after login.
*
* @return string Target URL
*/
add_filter( 'woocommerce_login_redirect', function() {
return wc_customer_edit_account_url();
} );
function max_entries_per_sitemap() {
return 100;
}
add_filter( 'wpseo_sitemap_entries_per_page', 'max_entries_per_sitemap' );
woocommerce_mini_cart();
echo WC()->cart->get_cart_contents_count();
/**
* Cart Fragments.
*
* Ensure cart contents update when products are added to the cart via AJAX.
*
* @param array $fragments Fragments to refresh via AJAX.
* @return array Fragments to refresh via AJAX.
*/
function my_woocommerce_cart_link_fragment( $fragments ) {
ob_start();
my_woocommerce_cart_link();
$fragments['#header-cart-contents'] = ob_get_clean();
return $fragments;
}
}
add_filter( 'woocommerce_add_to_cart_fragments', 'my_woocommerce_cart_link_fragment' );
/**
* Cart Link.
*
* Displayed a link to the cart including the number of items present and the cart total.
*
* @return void
*/
function my_woocommerce_cart_link() {
?>
<div id="header-cart-contents" class="header-cart">
<span><?= wp_kses_data( WC()->cart->get_cart_contents_count());?></span>
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>"><img src="<?= get_template_directory_uri();?>/img/header-cart.png" alt="shop-cart"></a>
</div>
<?php
}
}
my_woocommerce_cart_link();
$fragments['#header-cart-contents'] = ob_get_clean();
Обязательно был верный селектор вашего блока с корзинойfunction foo_theme_customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => function() {
bloginfo( 'description' );
},
) );
}
add_action( 'customize_register', 'foo_theme_customize_register' );
add_action('customize_register', 'dco_customize_register');
function dco_customize_register($wp_customize) {
//FOOTER
$wp_customize->add_section('footer', array(
'title' => 'Подвал',
'priority' => 1,
));
//footer text
$setting_name = 'footer_text';
$wp_customize->add_setting($setting_name, array(
'default' => '',
'sanitize_callback' => 'sanitize_textarea_field',
'transport' => 'postMessage'
));
$wp_customize->add_control($setting_name, array(
'section' => 'footer',
'type' => 'textarea',
'label' => 'Текст в подвале',
));
$wp_customize->selective_refresh->add_partial($setting_name, array(
'selector' => '.footer-desc',
'render_callback' => function() use ($setting_name) {
return nl2br(get_theme_mod($setting_name));
}
));
}
<div class="footer-desc"><?php echo nl2br(get_theme_mod('footer_text')); ?></div>
if ( $var % 6 )
возвращает 0 если переменная $var делится на 6 без остатка (то есть кратна 6). Все это есть и в документации PHP в разделе про арифметические операторы. error_reporting(E_ALL);
ini_set('display_errors', 0);
ini_set('log_errors','on');
ini_set('error_log', __DIR__ . '/logs/main_error.log');
php_value error_log logs/parse_error.log
try(){
}
catch(){
error_log($e->getMessage() . PHP_EOL, 3, __DIR__. '/logs/db_error.log');
}
// часовой пояс Москва
$main_timezone = get_option( 'timezone_string', 'Europe/Moscow' );
date_default_timezone_set( "$main_timezone" );
// для даты создания
function main_get_the_date($the_date, $d, $post) {
$d = 'd.m.Y';
$date_now = date_format(date_create("now"), $d);
$date_yesterday = date_format(date_create("yesterday"), $d);
$post = get_post($post);
if ( !$post ) {
return $the_date;
}
$the_date = mysql2date( $d, $post->post_date);
if ($date_now == $the_date) {
$the_date = esc_html__( 'сегодня', 'main' );
} elseif ($date_yesterday == $the_date) {
$the_date = esc_html__( 'вчера', 'main' );
}
return $the_date;
}
add_filter( 'get_the_date', 'main_get_the_date', 10, 3 );
// для даты изменения
function main_get_the_modified_date($the_time, $d) {
$d = 'd.m.Y';
$date_now = date_format(date_create("now"), $d);
$date_yesterday = date_format(date_create("yesterday"), $d);
$the_time = get_post_modified_time($d, null, null, true);
if ($date_now == $the_time) {
$the_time = esc_html__( 'сегодня', 'main' );
} elseif ($date_yesterday == $the_time) {
$the_time = esc_html__( 'вчера', 'main' );
}
return $the_time;
}
add_filter( 'get_the_modified_date', 'main_get_the_modified_date', 10, 2 );
$name = !empty($_POST['name'])?$_POST['name']:false;
$phone = !empty($_POST['phone'])?$_POST['phone']:false;
if($name and $phone){
//тут отправляем форму
}else{
//тут сообщаем об ошибке
}
esc_html
esc_attr
esc_js
esc_textarea