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 | |
$posts = get_posts( array( | |
'numberposts' => -1, | |
'post_type' => 'student', | |
'post_status' => 'publish', | |
'meta_query' => array( | |
'relation' => 'AND', | |
array( | |
'key' => 'acf_student_group', |
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 | |
// 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 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 the endpoints | |
add_action( 'init', 'yanco_add_my_account_endpoints' ); | |
function yanco_add_my_account_endpoints() { | |
add_rewrite_endpoint( 'my-custom-endpoint', EP_ROOT | EP_PAGES ); | |
add_rewrite_endpoint( 'my-custom-endpoint-2', EP_ROOT | EP_PAGES ); | |
} | |
// Make custom endpoints available to query vars |
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 | |
// 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 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 getParameterByName(name, url) { | |
if (!url) url = window.location.href; | |
name = name.replace(/[\[\]]/g, '\\$&'); | |
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, ' ')); | |
} |
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_shortcode( 'user_company_link', 'yanco_user_company_link' ); | |
function yanco_user_company_link() { | |
if( ! is_user_logged_in() ) { | |
return; | |
} | |
$html = ''; |
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( '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 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 | |
define( 'STAGING_URL', 'https://staging.mysiteurl.com'); | |
define( 'PRODUCTION_URL', 'https://www.mysiteurl.com'); | |
add_filter( 'wp_get_attachment_url', 'yanco_staging_wp_get_attachment_url', 1000000, 2 ); | |
function yanco_staging_wp_get_attachment_url( $url, $attachment ) | |
{ | |
if( strpos( $url, STAGING_URL ) !== false ) { | |
$url = str_replace( STAGING_URL, PRODUCTION_URL, $url ); |
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 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'), |
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
var urls = []; | |
var selector = "span.run > a"; | |
var base_url = "https://baseurl.com"; | |
jQuery( selector ).each( function() { | |
urls.push(base_url + jQuery(this).attr('href')); | |
}); | |
for (let i = 0; i < urls.length; i++) { |
NewerOlder