File: /home/zeusxp5/chuair.org/wp-content/themes/lifttruck/inc/block-styles.php
<?php
add_action('init', function() {
/* ------------------------ Site Logo Styles ---------------------------------------*/
register_block_style('core/site-logo', [
'name' => 'inverse',
'label' => __('Inverse', 'lifttruck'),
'inline_style' => '.wp-block-site-logo.is-style-inverse .inverse-logo { display: block; }
.wp-block-site-logo.is-style-inverse .custom-logo { display: none; }'
]);
register_block_style('core/media-text', [
'name' => 'media-on-the-top',
'label' => __('Media on the top', 'lifttruck'),
]);
register_block_style('core/media-text', [
'name' => 'media-on-the-top-2',
'label' => __('Media on the top 2', 'lifttruck'),
]);
register_block_style('core/media-text', [
'name' => 'media-in-the-bg',
'label' => __('Media in the background', 'lifttruck'),
]);
register_block_style('webdevia/accordion-block', [
'name' => 'media-in-the-bg',
'label' => __('Media in the background', 'lifttruck'),
]);
register_block_style('woocommerce/product-template', [
'name' => 'style-2',
'label' => __('Style 2', 'lifttruck'),
'inline_style' => '
.is-style-style-2.wc-block-product-template > li.wc-block-product {
border: 1px solid var(--wp--preset--color--gray-5);
border-radius: 4px;
padding-bottom: 1em;
> :not(.wc-block-components-product-image) {
padding-inline: 1rem;
background: var(--wp--preset--color--base);
transition: all .35s cubic-bezier(.66,.13,.38,1);
}
.wp-element-button {
background-color: var(--wp--preset--color--base);
color: var(--wp--preset--color--contrast);
border: 1px solid var(--wp--preset--color--contrast);
position: static;
padding: 6px 16px;
opacity: 1;
}
.wc-block-components-product-button {
align-items: unset;
display: flex;
flex-direction: column;
}
&:hover {
> :not(.wc-block-components-product-image) {
transform: translateY(-50px);
transition-duration: 0.35s
}
> :nth-child(2) {
transform: translateY(-50px);
transition-duration: 0.2s
}
> :nth-child(3) {
transform: translateY(-55px);
transition-duration: 0.275s
}
> :nth-child(4) {
transform: translateY(-60px);
}
> :nth-child(5) {
transform: translateY(-65px);
transition-duration: 0.35s
}
.wp-element-button.wp-block-button__link {
transform: none;
transition: all 0.2s;
background-color: var(--wp--preset--color--contrast);
color: var(--wp--preset--color--base);
}
}
}
',
]);
register_block_style('woocommerce/product-template', [
'name' => 'style-3',
'label' => __('Style 3', 'lifttruck'),
'inline_style' => '
.is-style-style-3.wc-block-product-template > li.wc-block-product {
.wc-block-components-product-image {
border: 1px solid var(--wp--preset--color--gray-5);
border-radius: 4px;
}
> :not(.wc-block-components-product-image) {
transition: all .35s cubic-bezier(.66,.13,.38,1);
}
.wp-element-button {
background-color: var(--wp--preset--color--base);
color: var(--wp--preset--color--contrast);
position: static;
padding: 6px 16px;
opacity: 1;
padding: 0;
&:before {
display: none;
}
}
.wc-block-components-product-button {
align-items: start;
position: absolute;
opacity: 0;
visibility: hidden;
width: 100%;
}
.wp-block-woocommerce-product-price {
overflow: hidden;
}
.wc-block-components-product-price {
transition: all .35s cubic-bezier(.66,.13,.38,1);
}
&:hover {
.wp-element-button.wp-block-button__link {
transform: none;
transition: all 0.2s;
}
.wc-block-components-product-price {
opacity: 0;
transform: translateY(-100%);
}
.wc-block-components-product-button {
transform: translateY(-35px);
opacity: 1;
visibility: visible;
}
}
}
',
]);
});
add_action( 'woocommerce_before_add_to_cart_quantity', 'lifttruck_after_add_to_cart_quantity' );
function lifttruck_after_add_to_cart_quantity(){
echo "<label for='quantity'>". __( 'Quantity', 'lifttruck' ) ."</label>";
}