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 | |
/** | |
* Product Open Pricing plugin: Customize Product Title with Price | |
* | |
* @param WC_Cart $cart | |
*/ | |
function custom_woocommerce_before_calculate_totals( $cart ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; |
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 | |
/** | |
* Fix for Elementor template conditions not compatible with Polylang (you need to save again one of your templates to make it work, after putting this function in your plugin/theme) | |
* Needs to be priority 1, since Polylang uses the action parse_query which is fired before pre_get_posts | |
* | |
* @link https://github.com/polylang/polylang/issues/152#issuecomment-320602328 | |
* | |
* @param WP_Query $query | |
*/ | |
function polylang_elementor_library_conditions_parse_query( $query ) { |
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 | |
/** | |
* Elementor get polylang translation of template | |
*/ | |
add_filter( 'elementor/theme/get_location_templates/template_id', function( $post_id ) { | |
if(!is_admin()){ | |
if ( function_exists( 'pll_get_post' ) ) { |
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 | |
/** | |
* Google Tag Manager: Exclude orders with status failed (only paid statuses) | |
* | |
* @param $tag | |
* | |
* @return string | |
*/ | |
function googletagmanager_getthetag( $tag ) { | |
global $wp; |
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 | |
/** | |
* ACF Disable Autocomplete on input and textarea fields | |
* Chrome ignores autocomplete="off" in some cases | |
* | |
* @author Nicolas Mollet | |
* @link https://bugs.chromium.org/p/chromium/issues/detail?id=468153 | |
*/ | |
function acf_input_disable_autocomplete() { |
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 | |
/** | |
* WooCommerce Product Price Shortcode Compatible with Multisite | |
* Example: [woocommerce_price_multisite id="6452" site="6"] | |
* | |
* @param $atts | |
* | |
*/ | |
function woocommerce_price_multisite( $atts ) { |
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 | |
/** | |
* Search results: display private posts if user has permission | |
* | |
* @param WP_Query $query | |
*/ | |
function custom_private_posts_earch_results( $query ) { | |
if ( current_user_can( 'read_private_posts' ) ) { | |
if ( $query->is_search() && $query->is_main_query() ) { | |
$query->set( 'post_status', [ 'publish', 'private' ] ); |
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( 'woocommerce_order_item_meta_start', 'custom_order_email_product_description', 10, 4 ); | |
function custom_order_email_product_description( $item_id, $item, $order, $plain_text = '' ){ | |
$item_data = $item->get_data(); | |
$product = wc_get_product($item_data['product_id'] ); | |
$product_short_description = $product->get_short_description(); | |
$product_description = $product->get_description(); | |
if ( ! empty( $product_short_description ) ) { |
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 | |
/** | |
* Polylang Shortcode - https://wordpress.org/plugins/polylang/ | |
* Add this code in your functions.php | |
* Put shortcode [polylang_langswitcher] to post/page for display flags | |
* | |
* @return string | |
*/ | |
function custom_polylang_langswitcher() { | |
$output = ''; |
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 | |
/** | |
* Polylang: Display a country flag or the name of the language as a "post state" | |
* | |
* @param array $post_states An array of post display states. | |
* @param \WP_Post $post The current post object. | |
* | |
* @return array A filtered array of post display states. | |
*/ | |
function polylang_display_post_states_language( $post_states, $post ) { |