Skip to content

Instantly share code, notes, and snippets.

function remove_guten_wrapper_styles(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' ); // REMOVE WOOCOMMERCE BLOCK CSS
wp_dequeue_style( 'global-styles' ); // REMOVE THEME.JSON
}
add_filter( 'block_editor_settings' , [$this, 'remove_guten_wrapper_styles'] );
// disable Gutenberg for posts
add_filter('use_block_editor_for_post', '__return_false', 10);
// disable Gutenberg for post types
add_filter('use_block_editor_for_page', '__return_false', 10);
add_filter('should_load_block_editor_scripts_and_styles', '__return_false', 10);
remove_theme_support( 'editor-color-palette' );
remove_theme_support( 'wp-block-styles' );
remove_theme_support( 'core-block-patterns' );
// disable Gutenberg for posts
add_filter('use_block_editor_for_post', '__return_false', 10);
// disable Gutenberg for post types
add_filter('use_block_editor_for_page', '__return_false', 10);
add_filter('should_load_block_editor_scripts_and_styles', '__return_false', 10);
remove_theme_support( 'editor-color-palette' );
remove_theme_support( 'wp-block-styles' );
remove_theme_support( 'core-block-patterns' );
remove_theme_support( 'editor-gradient-presets' );
remove_theme_support( 'editor-font-sizes' );
@guytzhak
guytzhak / shipping_based_weight.php
Created February 15, 2022 08:49
Woocommerce Shipping based rate
add_filter( 'woocommerce_package_rates', 'ras_custom_shipping_costs', 20, 2 );
function ras_custom_shipping_costs( $rates, $package ) {
$weights_prices_field = get_field('shipping_weights', 'options');
$weights_prices = [];
foreach ($weights_prices_field as $weights_price) {
$weights_prices[floatval($weights_price['weight'])] = floatval($weights_price['price']);
}
foreach( $rates as $rate_key => $rate ){
function filter_clinics_index( $query ) {
if ( !is_admin() && $query->is_main_query() && is_post_type_archive( 'clinic' )){
$meta_query = $query->get('meta_query');
if( is_array($meta_query) ) {
$meta_query['order_clinic_clause'] = [
'key' => 'order_clinic',
'compare' => 'EXISTS',
'type' => 'NUMERIC'
];
public static function getImage( $pic, $parent_id = '', $filename = false ) {
$server = WC_LI_Settings::SERVER;
$dev = get_option( 'wc_linet_dev' );
if ( $dev == 'on' ) {
$server = WC_LI_Settings::DEV_SERVER;
}
$basePath = wp_upload_dir()['basedir'] . '/';
if( $filename ) {
<iframe src="https://iqosiframe2.ussl.co/" width="100%" height="200px" style="border: 0; position: fixed; left: 0; bottom: 0; width: 100%; max-height: 100%; transition: 0.15s ease-out height;" class="mozi_iframe"></iframe>
<script>
var eventMethod = window.addEventListener
? "addEventListener"
: "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod === "attachEvent"
? "onmessage"
@guytzhak
guytzhak / iframebymozi.html
Created April 28, 2021 10:16
Iframebymozi
<iframe src="https://iqosiframe.ussl.co/" width="100%" height="200px" style="border: 0; position: fixed; left: 0; bottom: 0; width: 100%; max-height: 100%; transition: 0.15s ease-out height;" class="mozi_iframe"></iframe>
<script>
var eventMethod = window.addEventListener
? "addEventListener"
: "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod === "attachEvent"
? "onmessage"
<?php
add_action('get_footer', function () {
wp_enqueue_script( 'selectWoo' );
wp_enqueue_style( 'select2' );
wp_enqueue_script( 'delivery-js' );
}); ?>
<section class="delivery position-relative">
<?php
$bg = get_sub_field('bg');
if( isset($bg) && !empty($bg) ) {
if ( false === ( $customQuery = get_transient( 'projectName_related_products' ) ) ) {
$args = [
'post_type' => 'post',
];
$customQuery = new WP_Query($args);
set_transient( 'projectName_related_products', $customQuery, 99999 * HOUR_IN_SECONDS );