Instantly share code, notes, and snippets.

View astra-addon
ast-customizer CSS
ast-customizer JS
astra-addon CSS
astra-addon JS
View functions.php
if( is_plugin_active( 'woocommerce/woocommerce.php' ) )
if( class_exists( 'WooCommerce' ) )
View Pages to be excluded
/register
/login
/mepr
/account
/thank-you
View functions.php
function wc_exclude_by_product_tag( $query ) {
if ( $query->is_main_query() && is_woocommerce() && !is_user_logged_in() ) {
$taxquery = array(
array(
'taxonomy' => 'product_tag',
'field' => 'id',
'terms' => array( 6 ), // the ID of the product tag
'operator'=> 'NOT IN' // exclude
)
);
View functions.php
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 );
function replacing_add_to_cart_button( $button, $product ) {
$button_text = __("View product", "woocommerce");
$button = '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
return $button;
}
View functions.php
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
View ngnix.config
open_file_cache max=10000 inactive=10m;
open_file_cache_valid 20m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
View Command
wp option update classic-editor-replace classic --skip-themes --skip-plugins
wp option update classic-editor-allow-users disallow --skip-themes --skip-plugins
View Option name
classic-editor-replace > replace
default value is > no-replace
View functions.php
function kill_gutenberg_post_type( $is_enabled, $post_type ) {
if ( ‘post’ === $post_type || ‘page’ === $post_type ) {
return false; //==> add_action( ‘admin_print_scripts-edit.php’,…) ==> gutenberg_replace_default_add_new_button is disabled
}
return $is_enabled;
}
add_filter( ‘gutenberg_can_edit_post_type’, ‘kill_gutenberg_post_type’, 10, 2 ); //gutenberg_add_edit_link_for_post_type
function kill_gutenberg_modify_add_new_button_url( $url, $path ) {