This file contains hidden or 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_before_add_to_cart_form', 'woocommerce_variations_sold_out_filter' ); | |
| function woocommerce_variations_sold_out_filter() { | |
| // disable and add "sold out" to product variations | |
| wc_enqueue_js( ' | |
| var product_variations = $( "form.variations_form" ).data( "product_variations" ); | |
| // dont disable with multiple drop-downs | |
| if ( product_variations && $( "form.variations_form" ).find( "select" ).length === 1 ) { | |
| var attribute_name = $( "form.variations_form" ).find( "select" ).attr( "name" ); | |
| $.each( product_variations, function( key, value ) { |
This file contains hidden or 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_filter( 'woocommerce_product_related_posts_query', 'product_related_posts_query' ); | |
| function product_related_posts_query( $query ) { | |
| global $product, $wpdb; | |
| if ( is_object( $product ) ) { | |
| $terms_array = array(0); | |
| // get brands | |
| $terms = wp_get_post_terms( $product->id, 'product_brand' ); |
This file contains hidden or 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_filter( 'woocommerce_cart_item_name', 'cart_low_stock_note', 10, 3 ); | |
| function cart_low_stock_note( $title, $cart_item, $cart_item_key ) { | |
| if( $cart_item ) { | |
| $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
| $output = ''; | |
| $output.= $title; | |
| // threshold | |
| if( $_product->get_stock_quantity() <= 4 ) { |
This file contains hidden or 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
| {% comment %} | |
| Google sitelinks search box, people can reach your content more quickly from search results. | |
| More information on sitelinks: | |
| https://developers.google.com/webmasters/richsnippets/sitelinkssearch | |
| {% endcomment %} | |
| <script type="application/ld+json"> | |
| { | |
| "@context": "http://schema.org", | |
| "@type": "WebSite", |
This file contains hidden or 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_filter( 'posts_where', 'search_by_sku' ); | |
| function search_by_sku( $where ) { | |
| if( ! is_search() ) { | |
| return $where; | |
| } | |
| global $wpdb; | |
| $query = get_search_query(); |
This file contains hidden or 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
| UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
| UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
| UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
| UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
This file contains hidden or 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
| /** | |
| * Exclude pages from Jetpack top posts widget | |
| * | |
| * @param array $posts | |
| * @param array $post_ids | |
| * @param int $count | |
| * @return array | |
| */ | |
| add_filter( 'jetpack_widget_get_top_posts', 'exclude_widget_get_top_posts', 10, 3 ); |
This file contains hidden or 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 c4a8a13f4e5_woocommerce_shortcode_products_query( $query_args, $atts ) { | |
| $query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; | |
| return $query_args; | |
| } | |
| add_filter( 'woocommerce_shortcode_products_query', 'c4a8a13f4e5_woocommerce_shortcode_products_query', 10, 2 ); | |
| function c4a8a13f4e5_shortcodes_pagination() { |
This file contains hidden or 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
| <ifModule mod_headers.c> | |
| Header set Access-Control-Allow-Origin: * | |
| </ifModule> |
This file contains hidden or 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
| /** | |
| * Capture user login and add it as timestamp in user meta data | |
| * | |
| */ | |
| function 12kdksd212_user_last_login( $user_login, $user ) { | |
| update_user_meta( $user->ID, 'last_login', time() ); | |
| } | |
| add_action( 'wp_login', '12kdksd212_user_last_login', 10, 2 ); | |
OlderNewer