Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / blc-posts-shortcode-add-years-arg.php
Created July 4, 2024 07:36
Blocksy Posts Shortcode Add Years arg
<?php
add_filter('blocksy:general:shortcodes:blocksy-posts:args', function ($query_args, $shortcode_args) {
if (isset($shortcode_args['years'])) {
$years = array_map('intval', explode(',', $shortcode_args['years']));
$query_args['date_query'] = array(
'relation' => 'OR',
array_map(function ($year) {
return array('year' => $year);
}, $years)
);
@tdmrhn
tdmrhn / blc-2-woo-single-gallery-mobile-resize.css
Created June 7, 2024 09:42
Blocksy 2 Woo Single Gallery and Thumbnails resize
@tdmrhn
tdmrhn / blc-2-echo-content-block-product-attribute-term.php
Created June 2, 2024 15:10
Blocksy 2 Content Blocks Hook + Product Attribute (and term)
<?php
// Change the hook as you want
// Remove "//"s if you want to check the color attribute specific term
add_action( 'woocommerce_product_meta_end', function () {
global $product;
$attributes = $product->get_attributes();
if ( isset( $attributes['pa_color'] ) ) {
// $color_terms = wc_get_product_terms( $product->get_id(), 'pa_color', array( 'fields' => 'names' ) );
// if ( in_array( 'Red', $color_terms ) ) { // Check if 'Red' is one of the terms
@tdmrhn
tdmrhn / blc-posts-shortcode-from-query.php
Created May 24, 2024 06:32
Blocksy Posts Shortcode exclude current post from query
<?php
add_filter('blocksy:general:shortcodes:blocksy-posts:args', function ($query_args, $shortcode_args) {
if (is_singular('portfolio')) {
$query_args['post__not_in'] = array(get_the_ID());
}
return $query_args;
}, 10, 2);
@tdmrhn
tdmrhn / woo-get-product-description-from-acf.php
Created May 18, 2024 11:11
Woo Get Product description from ACF
<?php
$product_id = get_field('your_acf_field_name');
if ($product_id) {
$product = wc_get_product($product_id);
if ($product) {
$product_description = $product->get_description();
echo $product_description;
}
}
@tdmrhn
tdmrhn / blc-2-shop-loop-card-custom-quickview-link.php
Created May 17, 2024 07:50
Blocksy 2 Shop Loop Card Custom Quick View Link
@tdmrhn
tdmrhn / remove-author-meta-link.php
Created April 18, 2024 09:29
Wordpress Remove Author Meta Link
@tdmrhn
tdmrhn / blc-2-woo-quantity-type-2-remove-button-spaces.css
Created April 17, 2024 09:54
Blocksy 2 Woo Quantity Type 2 Remove Button Spaces
.quantity[data-type="type-2"] .ct-increase {
inset-inline-end: 0;
}
.quantity[data-type="type-2"] .ct-decrease {
inset-inline-start: 0;
}
.quantity[data-type="type-2"] .ct-increase, .quantity[data-type="type-2"] .ct-decrease {
top: 0;
width: calc(var(--quantity-height, 55px)/1.3);
height: 100%;
@tdmrhn
tdmrhn / blc-2-single-posts-custom-tag-design.css
Created April 7, 2024 07:20
Blocksy 2 Single Posts Custom Tag Design
.entry-tags > a {
--price-tag-height: 25px;
--price-border-radius: 4px;
position: relative;
display: inline-flex;
height: var(--price-tag-height);
margin-left: calc(var(--price-tag-height) / 2);
padding: 0 calc(var(--price-tag-height) / 2);
color: #fff;
@tdmrhn
tdmrhn / blc-2-disable-cart-checkout-buttons.css
Created April 5, 2024 08:09
Blocksy 2 Disable cart and checkout buttons on opposite pages
body.woocommerce-cart .woocommerce-mini-cart__buttons .wc-forward:not(.checkout),
body.woocommerce-checkout .woocommerce-mini-cart__buttons .checkout
{ display: none; }
body.woocommerce-cart .woocommerce-mini-cart__buttons,
body.woocommerce-checkout .woocommerce-mini-cart__buttons
{ grid-template-columns: 1fr; }