Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / blc-thank-you-hooks.php
Created Aug 1, 2022
Blocksy thank you page hooks
View blc-thank-you-hooks.php
<?php
// before table
add_action( 'woocommerce_thankyou_order_received_text', function ( $order_id ) {
echo do_shortcode( '[blocksy-content-block id="XXX"]' );
});
// after table
add_action( 'woocommerce_thankyou', function ( $order_id ) {
echo do_shortcode( '[blocksy-content-block id="XXX"]' );
});
@tdmrhn
tdmrhn / blc-stop-video-when-close-popup.php
Created Jul 23, 2022
Blocksy stop embed video when close popup
View blc-stop-video-when-close-popup.php
<?php
add_action('wp_footer', function() {
?>
<script>
jQuery(document).ready(function($) {
jQuery('.ct-toggle-close').click(function (e) {
var $stopvideo = jQuery(this).closest('.ct-popup').find('iframe');
$stopvideo.attr('src', $stopvideo.attr('src'));
});
});
@tdmrhn
tdmrhn / blc-remove-customizer-padding.php
Created Jul 20, 2022
Blocksy Remove Customizer Preview Iframe Padding
View blc-remove-customizer-padding.php
<?php
add_action( 'print_head_scripts', function () {
echo '<style>';
echo '.preview-desktop #customize-preview { padding: 0 !important }';
echo '.preview-desktop #customize-preview iframe { width: 100%; height: 100% }';
echo '</style>';
} );
@tdmrhn
tdmrhn / blc-add-gutenberg-support-to-products.php
Created Jul 14, 2022
Blocksy Adding/Editing Products with Gutenberg
View blc-add-gutenberg-support-to-products.php
<?php
add_filter('use_block_editor_for_post_type', function ($gutenproduct, $post_type) {
if($post_type == 'product'){
$gutenproduct = true;
}
return $gutenproduct;
}, 10, 2);
add_filter( 'woocommerce_taxonomy_args_product_cat', 'enable_taxonomy_rest' );
add_filter( 'woocommerce_taxonomy_args_product_tag', 'enable_taxonomy_rest' );
@tdmrhn
tdmrhn / blc-add-wa-mail-icon-links-woo-orders.php
Last active Jul 10, 2022
Add Whatsapp - Email icon links to Woo Orders Table
View blc-add-wa-mail-icon-links-woo-orders.php
@tdmrhn
tdmrhn / blc-blog-simple-card-alternative-design.css
Created Jul 7, 2022
Blocksy Blog Posts Simple Card Alternative Design
View blc-blog-simple-card-alternative-design.css
@media only screen and (min-width: 700px) {
/* 2n image right posts */
[data-prefix="blog"] [data-layout="simple"] article:nth-child(2n) > .ct-image-container
{ order: 1; margin-inline-start: 30px !important; margin-inline-end: 0 !important; margin-right: calc(var(--card-inner-spacing, 30px) * -1) !important; }
/* first + 5n here post */
[data-prefix="blog"] [data-layout="simple"] article:first-child,
[data-prefix="blog"] [data-layout="simple"] article:nth-child(5n) /* change it to 3n/4n if you want */
{ position: relative; --card-inner-spacing: 0 }
[data-prefix="blog"] [data-layout="simple"] article:first-child > .ct-image-container,
@tdmrhn
tdmrhn / blc-get-site-name.php
Created Jul 5, 2022
Blocksy Get Site Name/Title with Shortcode
View blc-get-site-name.php
<?php
add_shortcode( 'my_site_title', function () {
return get_bloginfo( 'name' );
} );
// Usage; [my_site_title]
View blc-change-comments-form-heading-tag.php
<?php
add_filter( 'comment_form_defaults', function ($defaults) {
// $defaults['title_reply'] = __( 'Add a Comment' );
$defaults['title_reply_before'] = '<h4 id="reply-title" class="comment-reply-title">';
$defaults['title_reply_after'] = '</h4>';
return $defaults;
});
@tdmrhn
tdmrhn / blc-product-reviews-show-featured-image.php
Created Jul 1, 2022
Blocks Product Reviews show featured image before decription
View blc-product-reviews-show-featured-image.php
@tdmrhn
tdmrhn / blc-remove-tax-archive-title-prefix.php
Created Jun 30, 2022
Blocksy Remove WP core archive title prefix
View blc-remove-tax-archive-title-prefix.php
<?php
// remove category: from archives
add_filter( 'get_the_archive_title', function ($title) {
if ( is_tax() ) {
$title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
}
return $title;
});