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 | |
$phone = "555555555"; // The phone number. | |
$country = "us_US"; // The country selected in the address related to the phone number. | |
$group = "billing"; // The group of the phone number (billing, shipping). | |
$wc_validate_phone = true; // If WooCommerce phone validation should be used in addition. | |
$format = "standardize_e164"; // Standardize setting: standardize_international, no_standardize, standardize_national, standardize_e164). | |
$validator = \phone_validator_and_formatter()->validator();// Get validator. | |
$phone_is_valid = $validator->is_valid($phone, $country, $group, $wc_validate_phone); |
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 // don't copy this line | |
/** | |
* @snippet WooCommerce: My Account Orders Pagination - per page setting | |
* @source https://kybernaut.cz/?p=2896 | |
* @author Karolína Vyskočilová (https://kybernaut.cz) | |
* @testedwith WordPress 5.2 & WooCommmerce 3.6.2 | |
*/ | |
// ------------------- | |
function kbnt_my_account_orders( $args ) { |
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('wp_img_tag_add_decoding_attr', '__return_false'); |
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 // don't copy this line | |
/** | |
* Add page template support | |
* @return void | |
* @author Karolína Vyskočilová (https://kybernaut.cz) | |
* @see https://wordpress.org/support/topic/page-templates-missing-from-page-attributes-after-5-8/ | |
* @updated 2021-08-19 | |
*/ | |
function add_page_template_support_missing_in_WP_5_8() |
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 // nekopírujte tento řádek | |
/** | |
* @snippet WooCommerce: Ulice (první řádek) obsahuje alespoň jednu číslici (číslo popisné) | |
* @author Karolína Vyskočilová (https://kybernaut.cz) | |
* @testedwith WordPress 5.8 & WooCommmerce 5.5 | |
*/ | |
function my_theme_validate_street( $fields, $errors ){ | |
if ( ! preg_match('/[0-9]+/', $fields['billing_address_1']) && !empty( $fields['billing_address_1'] ) ) { | |
$errors->add( 'validation', __( '<strong>Adresa ulice</strong> musí obsahovat číslo popisné.', 'my-theme' ) ); |
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 | |
// Do not copy the line above if you don't need it. | |
/** | |
* Has block function which searches as well in reusable blocks. | |
* | |
* Extends functionality of core's has_block (https://developer.wordpress.org/reference/functions/has_block/) | |
* | |
* @author Karolína Vyskočilová <karolina@kybernaut.cz> | |
* @since 2021-04-12 |
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
/** | |
* @snippet Add Stock Filter to Products page in WordPress admin | WooCommerce | |
* @comment Localization is automatic if you have localized WooCommerce to your language | |
* @source https://gist.github.com/vyskoczilova/fbc9dd818af20ff514cdb2d50eab410a | |
* @updatedversionof https://popoleodesigns.com/add-inout-of-stock-filter-to-wordpress-admin/ | |
* @author Karolína Vyskočilová | |
* @testedwith WooCommerce 3.0.7 | |
*/ | |
// ------------------- |
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
/** | |
* Solving a trouble with WP Engine which is caching website without URL parameters and re-attaches them back once the request is compiled. | |
* If you need to add UTM values to any form (not only CF7) you can use this JS snippet on the form page. | |
* | |
* Author: Karolína Vyskočilová (karolina@kybernaut.cz) | |
* Author website: https://kybernaut.cz | |
* Date created: 2020-11-13 | |
* | |
* Read more about WP Engine's cache: https://wpengine.com/support/utm-gclid-variables-caching/ | |
*/ |
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 | |
/** | |
* Plugin Name: Theme Guard | |
* Plugin URI: https://kybernaut.cz/?p=3204 | |
* Description: Check if theme exists and is active or die. | |
* Version: 0.0.1 | |
* Author: Karolína Vyskočilová | |
* Author URI: https://kybernaut.cz | |
* License: MIT |
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 | |
/** | |
* @snippet Tax placeholders for Price Display Suffix | WooCommerce | |
* @comment Use "{tax_rate}" and "{tax_rate_label}" placeholder for displaying the product tax rate and its label | |
* @source https://gist.github.com/vyskoczilova/2ff56afcfd4c75338fb7f0be3a5615c2 | |
* @author Karolína Vyskočilová (https://kybernaut.cz) | |
* @testedwith WooCommerce 4.2 | |
*/ | |
// ------------------- |
NewerOlder