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 gift icon the Shop menu item | |
* | |
* @param $sorted_menu_items | |
* | |
* @return mixed | |
*/ | |
function gifticon_nav_menu_objects( $sorted_menu_items ) | |
{ |
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 | |
/** | |
* Replace Home menu item by home icon | |
* | |
* @param $sorted_menu_items | |
* | |
* @return mixed | |
*/ | |
function homeicon_nav_menu_objects( $sorted_menu_items ) | |
{ |
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 | |
/** | |
* Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer | |
*/ | |
function elementor_css_in_head(){ | |
if(class_exists('\Elementor\Plugin')){ | |
$elementor = \Elementor\Plugin::instance(); | |
$elementor->frontend->enqueue_styles(); | |
} | |
if(class_exists('\ElementorPro\Plugin')){ |
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 ) { |
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 | |
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 | |
/** | |
* 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 | |
/** | |
* 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 | |
/** | |
* 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 | |
/** | |
* Google Tag Manager: Exclude orders with status failed (only paid statuses) | |
* | |
* @param $tag | |
* | |
* @return string | |
*/ | |
function googletagmanager_getthetag( $tag ) { | |
global $wp; |