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 | |
// Customize SearchWP Engine used. | |
add_filter( 'searchwp\native\args', function( $args, $query ) { | |
$args['engine'] = 'supplemental'; | |
return $args; | |
}, 15, 2 ); |
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
/* Sort Posts by Custom Date Field */ | |
add_action( 'elementor/query/event_sort_date', function( $query ) { | |
$query->set( 'meta_key', 'event_date' ); | |
$query->set( 'orderby', 'meta_value_num' ); | |
$query->set( 'order', 'ASC' ); | |
}); |
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 | |
/** | |
* The Template for displaying product archives, including the main shop page which is a post type archive | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and |
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 | |
add_filter( 'single_template', 'update_view_counter' ); | |
function update_view_counter( $single_template ) { | |
global $post; | |
$old_count = get_post_meta( $post->ID, 'sk_view_counter', true ); | |
update_post_meta($post->ID, 'sk_view_counter', ($old_count+1)); | |
return $single_template; | |
} |
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 | |
add_action( 'elementor/widget/posts/skins_init',function($widget) { | |
class change_meta_data extends \ElementorPro\Modules\Posts\Skins\Skin_Cards { | |
public function get_id() { | |
return 'cards'; | |
} | |
public function get_title() { | |
return esc_html__( 'Card', 'elementor-pro' ); | |
} |
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
# Create a Popup | |
1. Create a standard Elementor Popup | |
2. Set the Display Conditions for the pages you want to use it on | |
3. Take a note of the Popup ID | |
# JavaScript Code | |
1. In this example add an HTML Widget to the page | |
2. Copy and paste the code below into the Widget | |
3. Change the "popupId" constant you the ID of your |
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 remove_image_zoom_support() { | |
remove_theme_support( 'wc-product-gallery-zoom' ); | |
} | |
add_action( 'wp', 'remove_image_zoom_support', 100 ); |
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 custom_single_product_image_html( $html, $post_id ) { | |
$post_thumbnail_id = get_post_thumbnail_id( $post_id ); | |
return get_the_post_thumbnail( $post_thumbnail_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) ); | |
} | |
add_filter('woocommerce_single_product_image_thumbnail_html', 'custom_single_product_image_html', 10, 2); |
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 | |
// before addto cart, only allow 1 item in a cart | |
add_filter( 'woocommerce_add_to_cart_validation', 'woo_custom_add_to_cart_before' ); | |
function woo_custom_add_to_cart_before( $cart_item_data ) { | |
global $woocommerce; | |
$woocommerce->cart->empty_cart(); | |
// Do nothing with the data and return | |
return true; | |
} |
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
/* OR you can use singular_name instead of name like: */ | |
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'filter_dropdown_variation_args', 10 ); | |
function filter_dropdown_variation_args( $args ) { | |
$args['show_option_none'] = apply_filters( 'the_title', get_taxonomy( $args['attribute'] )->labels->singular_name ); | |
return $args; | |
} |
OlderNewer