Skip to content

Instantly share code, notes, and snippets.

@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-two-row-header-logo.css
Last active December 16, 2024 11:59
Blocksy Header design: Logo across two rows
@media only screen and (min-width: 1000px) {
[data-row*="bottom"]
{ z-index: 50 !important; }
[data-sticky]:not([data-sticky*="yes"]) .site-logo-container
{ --logo-max-height: 90px !important; margin-top: -90px; }
}
@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-hide-cart-when-empty.css
Last active November 21, 2024 17:00
Blocksy Hide Cart When Empty
/* firefox doesn't yet support "has" pseudo */
.ct-header-cart:has([data-count="0"]) { display: none; }
@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;
}
}
}
@tdmrhn
tdmrhn / blc-2-flexy-gallery-expand-trigger.css
Created October 24, 2024 05:31
Blocksy 2 Woo Gallery Expand Lightbox Trigger
@tdmrhn
tdmrhn / blc-2-disable-shop-sort-icon.css
Created October 20, 2024 07:33
Blocksy 2 Disable Shop Sort Icon for mobile
@media (max-width: 689.98px) {
.woo-listing-top .woocommerce-ordering select {
color: inherit;
width: inherit;
padding: 0 15px;
background-image: url("data:image/svg+xml,%3Csvg width='21' height='13' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5.379L20.621 2.5 10.5 12.621.379 2.5 2.5.379l8 8z' fill='%234F5D6D' fill-rule='nonzero'/%3E%3C/svg%3E");
}
.ct-sort-icon {
display: none;
}
@tdmrhn
tdmrhn / persona-title-effect.css
Created September 17, 2021 11:51
Persona Title Effect
.blog .page-title::after, .page .page-title::after {
content: attr(title);
position: absolute;
z-index: -1;
top: -7%;
bottom: 0;
width: 100%;
height: 100%;
white-space: nowrap;
display: flex;