Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / blc-2-show-swatch-tooltip-always.css
Created March 8, 2025 08:42
Bllocksy 2 Always Show Swatch Tooltips
.single-product .ct-swatch-container { flex-direction: column-reverse; gap: 5px; align-items: center}
.single-product .ct-swatch-container .ct-tooltip,
.single-product .ct-swatch-container:hover .ct-tooltip { transform: none; transition: none; position: relative; opacity: 1; visibility: visible; background: transparent; }
.single-product .ct-swatch-container .ct-tooltip:before,
.single-product .ct-swatch-container .ct-tooltip:after { display: none; }
@tdmrhn
tdmrhn / show-only-parent-taxonomy-terms-in-single.php
Created February 16, 2025 11:22
Show only parent taxonomy terms in blog single post
<?php
add_filter('get_the_terms', function($terms, $post_id) {
if (is_single() && get_post_type($post_id) === 'post') {
return array_filter($terms, fn($term) => $term->parent === 0);
}
return $terms;
}, 10, 3);
@tdmrhn
tdmrhn / blc-2-color-switcher.html
Created February 13, 2025 17:37
Blocksy 2 Color Switcher
<button class="ct-color-switch ct-toggle " data-color-switch="reversed" data-label="bottom" aria-label="Color mode switch" data-id="color-mode-switcher">
<span class="ct-label ct-hidden-sm ct-hidden-md" aria-hidden="true">
<span class="ct-dark-mode-label">Dark Mode</span>
<span class="ct-light-mode-label">Light Mode</span>
</span>
</button>
@tdmrhn
tdmrhn / deregister-plugin-scripts-widgets.php
Last active February 19, 2025 09:35
Deregister Plugin Scripts for Widgets
<?php
//
// Godaddy
//
add_action('enqueue_block_editor_assets', function () {
global $wp_customize;
if (! $wp_customize) {
return;
}
@tdmrhn
tdmrhn / blc-2-mobile-full-width-gallery.css
Created February 10, 2025 15:14
Blocksy 2: Mobile Full width Product Gallery
@tdmrhn
tdmrhn / blc-2-disable-all-content-blocks.php
Created December 26, 2024 15:47
Blocksy 2: Disable all Content Blocks
<?php
add_action('init', function() {
$all_content_blocks = get_posts([
'post_type' => 'ct_content_block',
'posts_per_page' => -1,
'post_status' => 'publish',
'fields' => 'ids'
]);
foreach ($all_content_blocks as $block_id) {
@tdmrhn
tdmrhn / blc-2-add-discounted-price-to-sale-badge.php
Created December 2, 2024 10:16
Blocksy 2 add discounted price to sale badge
<?php
add_filter('woocommerce_sale_flash',function ($text, $post, $product) {
if (strpos($text, '<span class="onsale">') === false) {
return $text;
}
if (blocksy_get_theme_mod('sale_badge_value', 'default') === 'custom') {
$text = blocksy_get_theme_mod('sale_badge_custom_value', '-{price}');
if ($product->is_type('variable')) {
@tdmrhn
tdmrhn / blc-2-read-bar-under-header.css
Created November 18, 2024 08:17
Blocksy 2 move read progress bar under header
.ct-read-progress-bar {
top: calc(var(--admin-bar, 0px) + var(--theme-frame-size, 0px) + var(--header-sticky-height) + var(--header-sticky-offset));
}
@tdmrhn
tdmrhn / blc-2-exclude-cpt-from-customizer.php
Created November 15, 2024 08:38
Blocksy 2 exclude custom post types from customizer
<?php
add_filter('blocksy:custom_post_types:supported_list', function($post_types) {
// Remove 'projects' custom post type from the list of supported post types for customizer
$post_types = array_diff($post_types, ['projects']);
return $post_types;
});
@tdmrhn
tdmrhn / woo-show-sale-badge-even-one-variation.php
Created November 12, 2024 11:48
Woo sale badge display even with only one variation
<?php
add_filter('woocommerce_product_is_on_sale', function ($on_sale, $product) {
if ($product->is_type('variable') && (is_shop() || is_product() || is_product_category() || is_product_tag())) {
foreach ($product->get_children() as $variation_id) {
$variation = wc_get_product($variation_id);
if ($variation->is_on_sale()) {
return true;
}
}
}