View phone_check.js
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 checkPhoneFormat (phone) { | |
var prefix = [ | |
'086', | |
'096', | |
'097', | |
'098', | |
'032', | |
'033', | |
'034', | |
'035', |
View _blank.js
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
// vanilla JavaScript | |
var links = document.links; | |
for (var i = 0, linksLength = links.length; i < linksLength; i++) { | |
if (links[i].hostname != window.location.hostname) { | |
links[i].target = '_blank'; | |
} | |
} | |
// or in jQuery |
View gist:bb5b420400eefdc16fb8517630ad602e
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 | |
function wpmlsupp_1706_reset_wpml_capabilities() { | |
if ( function_exists( 'icl_enable_capabilities' ) ) { | |
icl_enable_capabilities(); | |
} | |
} | |
add_action( 'shutdown', 'wpmlsupp_1706_reset_wpml_capabilities' ); |
View woo_min_max_price.php
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 | |
/* Source: woocommerce\includes\widgets\class-wc-widget-price-filter.php:119 */ | |
function woo_get_filtered_price() { | |
global $wpdb; | |
$args = wc()->query->get_main_query()->query_vars; | |
$tax_query = isset( $args['tax_query'] ) ? $args['tax_query'] : array(); | |
$meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array(); | |
if ( ! is_post_type_archive( 'product' ) && ! empty( $args['taxonomy'] ) && ! empty( $args['term'] ) ) { |
View autocomplete_taxonomies.php
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( 'vc_autocomplete_[shortcode_base]_[param_name]_callback', 'vc_autocomplete_taxonomies_field_search', 10, 1 ); | |
add_filter( 'vc_autocomplete_[shortcode_base]_[param_name]_render', 'vc_autocomplete_taxonomies_field_render', 10, 1 ); | |
$args = array( | |
'name' => 'Shortcode Name', | |
'base' => 'shortcode_base', | |
'category' => __( 'Themes Elements', 'vtm' ), | |
'params' => array( | |
array( |
View wp_upload_from_url.php
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 | |
// Upload image from url | |
// Returns an array (attachment_id, url), or false | |
function media_import_from_url( $url ) { | |
$filename = basename($url); | |
global $wpdb; | |
$query = "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_value LIKE '%/$filename'"; | |
$count = intval($wpdb->get_var($query)); |
View gist:fa23188ab77a724289fcbef1df4723de
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 | |
// visual composer is enabled for a post/page | |
$vc_enabled = get_post_meta($post_id, '_wpb_vc_js_status', true); |
View checkbox.css
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
.checkbox { | |
input[type="checkbox"], input[type="radio"] { display: none; } | |
label { | |
position: relative; | |
padding-left: 20px; | |
&:before { | |
content: ''; | |
width: 15px; height: 15px; | |
border: 1px solid #fff; |
View disable_right_click.js
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
document.addEventListener('contextmenu', event => event.preventDefault()); |
View add_customer_detail_on_email_woo.php
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
// class-wc-emails.php:443 | |
public function customer_details( $order, $sent_to_admin = false, $plain_text = false ) { | |
// if ( ! is_a( $order, 'WC_Order' ) ) { | |
// return; | |
// } | |
$fields = array(); | |
if ( $order->customer_note ) { |
NewerOlder