Skip to content

Instantly share code, notes, and snippets.

Tuan Phan tuanbbhero

View GitHub Profile
View Remove Add to Cart Button on Woo Product Page
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
View Move Description to Bottom of WooCommerce Page
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 10 );
View Show Description on Product Category Page WooCommerce
function kl_woocommerce_taxonomy_archive_description() {
if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) != 0 ) {
$description = wc_format_content( kl_description() );
if ( $description ) {
echo '<div class="kl-description">' . $description . '</div>';
}
}
}
add_action( 'woocommerce_archive_description', 'kl_woocommerce_taxonomy_archive_description');
View Show Specific Category on Shop Page
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() && is_shop() ) {
$q->set( 'tax_query', array(array(
View Limit Post Revisions
define('AUTOSAVE_INTERVAL', 300); // seconds
define('WP_POST_REVISIONS', 3);
View Search Widget Module CSS - Beaver Builder
/* CSS by BeaverHero.com */
/* Insert to Appearance > Customize > Additional CSS (Custom CSS) OR Layout CSS & JavaScript > CSS */
/* Detail: https://beaverhero.com/search-widget-module-css-bb */
/* 1. SEARCH FIELD */
.widget .search-field {
background-color: grey;
font-size: 25px;
font-family: Roboto, sans-serif;
text-transform: uppercase;
View Remove Description on Description Tab
add_filter( 'woocommerce_product_description_heading', '__return_null' );
View Add Script Code to Thank You Page WooCommerce
add_action( 'woocommerce_thankyou', 'kl_gg_analytics_thank_you_page' );
function kl_gg_analytics_thank_you_page() {
?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-107909516-7"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
@tuanbbhero
tuanbbhero / Add to Cart Button Color - WooCommerce
Created Mar 11, 2019
Customize Add to Cart Button: Color, Background Color
View Add to Cart Button Color - WooCommerce
/* You can use Color Name: red green white, or Color Code: #fff #222 #f8f8f8 */
/* 1. ADD TO CART ON PRODUCT PAGE */
.single-product form.cart .button {
color: green;
background-color: white;
border-color: red;
border-width: 1px;
border-style: solid;
}
.single-product form.cart .button:hover {
View Disable Gutenberg WP 5.0
add_filter('use_block_editor_for_post', '__return_false');
You can’t perform that action at this time.