This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function max_entries_per_sitemap() { | |
return 5000; | |
} | |
add_filter( 'wpseo_sitemap_entries_per_page', 'max_entries_per_sitemap' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gg_round_subtotal( $cart_subtotal; ) { | |
$cart_subtotal; = round( $cart_subtotal ); | |
return $cart_subtotal; | |
} | |
add_action( 'woocommerce_before_calculate_totals', 'gg_round_subtotal', 10, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gg_validation_filter( $result, $tag ) { | |
if ( 'your-name' == $tag[name] ) { | |
$items = array( '00','01','02' ); | |
$post_item = $_POST['your-name']; | |
if( !in_array( $post_item, $items ) ) { | |
$result->invalidate( $tag, "This is not a valid zip!" ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gg_add_ga() { | |
echo '<script>'; | |
echo '// ga code here'; | |
echo '</script>'; | |
} | |
add_action( 'wp_head', 'gg_add_ga' ); | |
add_action( 'wp_footer', 'gg_add_ga' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gg_postssearch($query) { | |
if( is_single( 'post' ) || is_post_type_archive( 'post' ) { | |
if( $query->is_search ) { | |
$query->set( 'post_type', 'post' ); | |
} | |
return $query; | |
} | |
} | |
add_filter( 'pre_get_posts',' gg_postssearch' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $woocommerce, $product; | |
$variation_count = count( $product->get_available_variations() ); | |
echo $variation_count; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gg_gfonts_prefetch() { | |
echo '<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>'; | |
echo '<link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin>'; | |
} | |
add_action( 'wp_head', 'gg_gfonts_prefetch' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_single_product_summary', 'gg_custom_before_upsells', '12 ); | |
function gg_custom_before_upsells() { | |
echo 'something here'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function product_desc_shortcode( $post_excerpt ) | |
{ | |
$price = do_shortcode( '[my_shortcode]' ); | |
return $price; | |
return $content; | |
} | |
add_filter('woocommerce_short_description', 'product_desc_shortcode', 10, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |