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( 'elementor/query/myonmarketpropertyquery', 'elementor_query_on_market_only' ); | |
| function elementor_query_on_market_only( $query ) | |
| { | |
| $meta_query = $query->get('meta_query'); | |
| $new_meta_query = $meta_query; | |
| $new_meta_query[] = array( | |
| 'key' => '_on_market', | |
| 'value' => 'yes' |
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
| jQuery(document).ready(function($) { | |
| var delay = 100; setTimeout(function() { | |
| $('.elementor-tab-title').removeClass('elementor-active'); | |
| $('.elementor-tab-content').css('display', 'none'); }, delay); | |
| }); |
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
| <?php | |
| /** | |
| * @credits https://jeroensormani.com/adding-a-custom-woocommerce-product-type/ | |
| */ | |
| //error_reporting(E_ALL); | |
| //ini_set('display_errors', 1); | |
| add_action('init' , 'wc_pm_load_product_type'); | |
| function wc_pm_load_product_type() { | |
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
| <?php | |
| $posts = maybeCache('remote_posts_data', 7200, function () { | |
| return do_remote_get('https://jsonplaceholder.typicode.com/posts/'); | |
| }); | |
| foreach ($posts as $post) { | |
| echo "<h2>{$post->title}</h2>"; | |
| } |
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
| <?php | |
| add_action('wp_enqueue_scripts', 'enqueue_if_shortcode'); | |
| function enqueue_if_shortcode(){ | |
| global $post; | |
| if ( $post && has_shortcode( $post->post_content, 'your_shortcode_tag' ) { | |
| // Enqueue | |
| } |
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
| <?php | |
| // Modify the fields to search in | |
| add_action( 'elementor/query/searched_query', function( $query ) { | |
| $s = get_search_query(); | |
| if ( is_search() ) { | |
| $query->set( 'post_type', 'leverandor' ); | |
| if( strlen($s) >= 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
| <?php | |
| // For variations | |
| add_action( 'woocommerce_variation_options_pricing', 'yanco_add_custom_field_to_variations', 10, 3 ); | |
| function yanco_add_custom_field_to_variations( $loop, $variation_data, $variation ) { | |
| woocommerce_wp_text_input( array( | |
| 'id' => 'custom_field[' . $loop . ']', | |
| 'class' => 'short', | |
| 'label' => __( 'Custom Field', 'woocommerce' ), | |
| 'value' => get_post_meta( $variation->ID, 'custom_field', true ) |
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
| <?php | |
| add_shortcode( 'user_company_link', 'yanco_user_company_link' ); | |
| function yanco_user_company_link() { | |
| if( ! is_user_logged_in() ) { | |
| return; | |
| } | |
| $html = ''; |
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
| <?php | |
| add_action( 'wp_login_failed', 'yanco_elementor_form_login_fail' ); | |
| function yanco_elementor_form_login_fail( $username ) { | |
| // where did the post submission come from? | |
| $referrer = $_SERVER['HTTP_REFERER']; | |
| // if there's a valid referrer, and it's not the default log-in screen | |
| if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) { |
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
| <?php | |
| /** | |
| * Add privacy policy tick box at checkout | |
| */ | |
| add_action( 'woocommerce_review_order_before_submit', 'yanco_add_checkout_privacy_policy', 9 ); | |
| function yanco_add_checkout_privacy_policy() { | |
| woocommerce_form_field( 'privacy_policy', array( | |
| 'type' => 'checkbox', | |
| 'class' => array('form-row privacy'), |