Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / blocksy_add_menu.php
Last active March 18, 2024 12:40
Blocksy Add Menu Shortcode
<?php
add_shortcode('listmenu', function ($atts, $content = null) {
extract(shortcode_atts(array( 'name' => null, 'class' => null ), $atts));
return wp_nav_menu( array( 'menu' => $name, 'menu_class' => 'mymenu', 'echo' => false ) );
} );
// Usage [listmenu name="Menu Name"]
@tdmrhn
tdmrhn / woo-show-featured-products-first-in-query.php
Created March 16, 2024 10:10
WooCommerce Show Featured Products First in Query
@tdmrhn
tdmrhn / blc-product-stacked-gallery-horizontal-scroll.css
Last active March 11, 2024 20:38
Blocksy Single Product Gallery Type-3 Horizontal Scrolling
@tdmrhn
tdmrhn / blc-2-customizer-grid-bento-grid.css
Created March 10, 2024 17:14
Blocksy 2: Easy Bento Grid for Archives with Customizer Grid Type
.entries[data-layout="grid"] article:first-child,
.entries[data-layout="grid"] article:nth-child(8n),
.entries[data-layout="grid"] article:nth-child(23n),
.entries[data-layout="grid"] article:nth-child(79n),
.entries[data-layout="grid"] article:nth-child(91n) {
grid-column: span 2;
}
.entries[data-layout="grid"] article:first-child,
.entries[data-layout="grid"] article:nth-child(7n),
.entries[data-layout="grid"] article:nth-child(45n),
@tdmrhn
tdmrhn / blc-2-customizer-grid-bento-grid.css
Created March 10, 2024 16:16
Blocksy 2: Easy Bento Grid for Archives with Customizer Grid Type
.entries[data-layout="grid"] article:first-child,
.entries[data-layout="grid"] article:nth-child(7n+1) {
grid-column: span 2;
}
.entries[data-layout="grid"] article:first-child,
.entries[data-layout="grid"] article:nth-child(5n+1) {
grid-row: span 2;
}
@tdmrhn
tdmrhn / blc-open-popup-after-added-to-cart.html
Created April 20, 2022 07:01
Blocksy Open Popup after Added to Cart
<script>
jQuery(document).ready(function ($) {
$('body').on('added_to_cart', function () {
blocksyOpenMicroPopup($('#ct-popup-XX')[0])
})
})
</script>
@tdmrhn
tdmrhn / blc-2-advanced-posts-bento-grid.css
Created March 6, 2024 15:10
Blocksy 2: Easy Bento Grid with Advanced Posts Block
.ct-post-grid article:first-child,
.ct-post-grid article:nth-child(7) {
grid-column: span 2;
}
.ct-post-grid article:first-child,
.ct-post-grid article:nth-child(5) {
grid-row: span 2;
}
.ct-post-grid article .wp-block-cover {
min-height: 250px;
@tdmrhn
tdmrhn / blc-2-close-filters-panel-when-click-item.php
Created March 3, 2024 15:45
Blocksy 2 Close Woo Filters Panel when click on an filter item
<?php
add_action('wp_footer', function () {
?>
<script>
document.body.addEventListener('click', (event) => {
const panel = document.getElementById("woo-filters-panel");
if (panel && event.target.closest('.ct-filter-item a')) {
event.preventDefault();
const toggleClose = panel.querySelector('.ct-toggle-close');
@tdmrhn
tdmrhn / woo-click-reviews-tab-default.php
Created March 3, 2024 15:37
Woo Force Click Product Tabs Reviews onload
<?php
add_action('wp_footer', function() {
if (is_product()) {
wc_enqueue_js('jQuery(document).ready(function($) { $(".reviews_tab a").click(); });');
}
}, 0);
@tdmrhn
tdmrhn / blc-2-preload-mini-cart-css.php
Last active February 29, 2024 13:55
Blocksy 2 Preload Mini Cart CSS file
<?php
add_action('wp_enqueue_scripts', function() {
$theme = blocksy_get_wp_parent_theme();
wp_enqueue_style(
'ct-legacy-mini-cart-styles',
blocksy_cdn_url(
get_template_directory_uri() . '/static/bundle/cart-header-element-lazy.min.css'
),
[],