Skip to content

Instantly share code, notes, and snippets.

View andreiglingeanu's full-sized avatar

Andrei Glingeanu andreiglingeanu

View GitHub Profile
<?php
add_action('wp_head', function () {
$term_id = get_queried_object_id();
if (! is_woocommerce() || ! $term_id || is_product()) {
return;
}
$attachment_id = get_term_meta($term_id, 'thumbnail_id');
<?php
add_filter(
'blocksy:pro:post-types-extra:acf:collect-fields',
function ($fields, $all_fields) {
$fields_to_allow = ['image'];
$result = [];
foreach ($all_fields as $single_field) {
<?php
add_filter('blocksy:woocommerce:product-single:layout', function ($layout) {
// Inspect layout for more info
foreach ($layout as $key => $value) {
if ($value['id'] === 'product_title') {
$layout[$key]['enabled'] = false;
}
}
<?php
add_action(
'blocksy:woocommerce:product-single:price:after',
function () {
if (function_exists('woocommerce_gzd_template_loop_price_unit')) {
woocommerce_gzd_template_loop_price_unit();
}
}
);
# WARNING: Run all the commands one by one and carefully examine the output of each command
# 1. First run the replace with dry run, to see which tables exactly will be affected and how many replacements will be there.
wp search-replace --dry-run "paletteColor" "theme-palette-color-"
wp search-replace --dry-run "buttonInitialColor" "theme-button-background-initial-color"
wp search-replace --dry-run "var(--fontFamily)" "var(--theme-font-family)"
wp search-replace --dry-run "var(--color)" "var(--theme-text-color)"
# 2. Actually perform the replacement
<?php
namespace Blocksy;
class Plugin {
/**
* Blocksy instance.
*
* Holds the blocksy plugin instance.
*
import { dispatch, select } from '@wordpress/data'
import swipercss from '!!raw-loader!../../../../libs/swiper/swiper-bundle.min.css'
import { applyFilters } from '@wordpress/hooks'
export default function gspb_Css_Final(id, final_css = '', props = {}) {
let inlineloading = false
if (greenShift_params.isSaveInline) {
inlineloading = true
<?php
namespace Blocksy\CustomPostType\Integrations;
class GreenShift extends \Blocksy\CustomPostTypeRenderer {
public function get_content($args = []) {
return \Blocksy\CustomPostTypeRenderer::NOT_IMPLEMENTED;
/*
$content_post = get_post($this->id);
<?php
namespace Blocksy;
/*
*/
class Capabilities {
private $accounts_cache = null;
<?php
add_action(
'template_redirect',
function () {
if (
is_singular()
||
is_single()
) {