Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andreiglingeanu's full-sized avatar

Andrei Glingeanu andreiglingeanu

View GitHub Profile
<?php
add_filter(
'blocksy:woocommerce:product-card:thumbnail:ratio',
function ($ratio) {
// Please change this
$my_page_id = 123;
if (is_page($my_page_id)) {
// Your custom ratio
<?php
add_filter(
'blocksy:general:blocks:query:args',
function ($query_args, $attributes) {
if (
isset($attributes['uniqueId'])
&&
$attributes['uniqueId'] === '9afc2324'
) {
<?php
add_filter(
'blocksy:pro:content-blocks:condition-match',
function ($matches, $content_block_id) {
if ($content_block_id === 15054) {
$resume_id = get_queried_object_id();
if (! resume_manager_user_can_view_resume($resume_id)) {
<?php
add_action(
'init',
function () {
global $wpdb;
$wpdb->query(
"
DELETE
<?php
if (! function_exists('write_log')) {
function write_log($log) {
if (is_array($log) || is_object($log)) {
error_log(print_r($log, true));
} else {
error_log($log);
}
}
<?php
add_filter(
'blocksy:pro:custom-post-type:output-content',
function ($content, $id) {
$BLOCKSY_THANK_YOU_PAGE_ID = 2478;
if ($id !== $BLOCKSY_THANK_YOU_PAGE_ID) {
return $content;
}
<?php
add_filter(
'rest_post_search_query',
function ($args) {
$args['post_type'] = array_diff(
$args['post_type'],
['ct_content_block']
);
@andreiglingeanu
andreiglingeanu / nullify-transforms.js
Last active January 30, 2024 22:17
A nice way to nullify CSS transforms and get original positions of the un-modified rect
// Nullify the transforms of the element
//
// This is all behaving just like getBoundingClientRect() but it nullifies all the transforms
// and kinds _reverts_ the element onto its original position.
// This will work even with complex translations, rotations.
// The beauty is in the way it applies matrix inverse onto the transformation
// matrix and mutates the getboundingclientrect along the way.
//
// Usage:
// let { top, left } = nullifyTransforms(el);
<?php
add_filter(
'blocksy:pro:woocommerce-extra:swatches:has-single-product-swatches',
function ($has_single_product_swatches) {
global $product;
if (has_term(array('sneakers'), 'product_cat', $product->get_id())) {
return false;
}
<?php
add_filter(
'blocksy:pro:woocommerce-extra:swatches:has-single-product-swatches',
function ($has_single_product_swatches) {
global $product;
$products_without_swatches = [
// list all product IDs that should not have swatches
105,