event.preventDefault();
const event = new Event('added_to_cart');
// слушать это событие
elem.addEventListener('added_to_cart', function (e) { /* ... */ }, false);
// вызвать это событие
elem.dispatchEvent(event);
// возвращается список, а не один элемент, поэтому работать не будет
document.getElementsByClassName('site').classList.add('container');
// вот так будет один элемент, если он есть в DOM-дереве
document.getElementsByClassName('site')[0].classList.add('container');
// вот так тоже будет один элемент, если он есть в DOM-дереве
document.querySelector('.site').classList.add('container');
<ellipse class="st1" cx="297.6" cy="420.9" rx="123.7" ry="20"/>
заменено на:<ellipse class="st1" cx="297.6" cy="420.9" rx="123.7" ry="20">
<animate attributeName="ry" dur="2s" repeatCount="indefinite" keyTimes="0;.5;1" values="20;0;20"/>
</ellipse>
$params = array(
'posts_per_page' => 12,
'post_type' => array('product', 'product_variation'),
'meta_query' => array(
array(
'key' => '_stock_status',
'value' => 'outofstock'
)
)
);
$wc_query = new WP_Query($params);
if ($wc_query->have_posts()) :
while ($wc_query->have_posts()) : $wc_query->the_post(); ?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php endwhile;
wp_reset_postdata();
else: ?>
<p><?php _e( 'No Products' );?></p>
<?php endif; ?>
var oldScrollY = 0;
var div = document.getElementById("masthead");
var footer = document.getElementById("footer");
window.onscroll = function() {
var scrolled = window.pageYOffset || document.documentElement.scrollTop;
var dY = scrolled - oldScrollY;
if ( dY > 0 ){
div.className = "site-header site-header-hide";
footer.className = "footer footer--active";
} else {
div.className = "site-header";
footer.className = "footer";
}
oldScrollY = scrolled;
}
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_price', 20, 2 ); // Shop and other archives pages
add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_price', 20, 2 ); // Single product pages
function custom_add_to_cart_price( $button_text, $product ) {
if( $product->is_type('variable') ) { // Variable products
if( ! is_product() ){ // shop and archives
$product_price = wc_price( wc_get_price_to_display( $product, array( 'price' => $product->get_variation_price() ) ) );
return $button_text . ' - From ' . strip_tags( $product_price );
} else { // Single product pages
return $button_text;
}
} else { // All other product types
$product_price = wc_price( wc_get_price_to_display( $product ) );
return $button_text . ' - Just ' . strip_tags( $product_price );
}
}
const li = document.querySelectorAll('li');
document.addEventListener('mouseover',e=>{
let targ = e.target.closest('li');
if(!targ) return;
[...li].forEach(item=>item!==targ?item.style.visibility='hidden':null);
targ.addEventListener('mouseleave',()=>{
[...li].forEach(item=>item.style.visibility='visible');
})
});
PRIMARY KEY AUTO_INCREMENT
для поля `id`, и пофиксить определение поля `text`CREATE TABLE `textlog` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`chat_id` int(111) NOT NULL,
`text` text NOT NULL,
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
$('input[name="radio"]').click(function(){
let id = $(this).val().toLowerCase() //строчные буквы
id = id.substring(0,id.length-1) //удаляем последний символ (1)
var target2 = $('.'+id+'-wrapper') //меняем селектор
$('.none').not(target2).hide(0); //ваша функция
target2.fadeIn(500);
});
<article id="post-<?php the_ID(); ?>" <?php post_class('blog-article'); ?>>
<header class="entry-header">
<!-- Как раз тут начинается вывод заголовка поста -->
<?php
if ( is_singular() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
endif;
if ( 'post' === get_post_type() ) :
?>
<?php endif; ?>
</header><!-- .entry-header -->
<!-- А тут заканчивается. Остальное можно удалить. -->