Skip to content

Instantly share code, notes, and snippets.

Avatar

Karolína Vyskočilová vyskoczilova

View GitHub Profile
View gist:4277401d2a6d310b88f8908808cef3af
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
@vyskoczilova
vyskoczilova / kybernaut_ico_dic_povinna-vsechna_pole.php
Created Jan 2, 2019
Kybernaut IČO DIČ - povinná všechna pole
View kybernaut_ico_dic_povinna-vsechna_pole.php
<?php // vynechte tento řádek
/**
* @snippet Nastavit všechna pole (IČO, DIČ, IČ DPH) jako povinné pole | Kybernaut IČO DIČ
* @comment Pokud používáte plugin Kybernaut IČO DIČ a potřebujete mít pole všechna pole jako povinné, použijte tento snippet.
* @source https://kybernaut.cz/clanky/wp-multisite-maximalni-velikost-nahravaneho-souboru/
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress 5.0.2
*/
// -------------------
@vyskoczilova
vyskoczilova / kybernaut_ico_dic_povinne_ico.php
Created Jan 2, 2019
Kybernaut IČO DIČ - povinné IČO
View kybernaut_ico_dic_povinne_ico.php
<?php // vynechte tento řádek
/**
* @snippet IČO (Business ID) jako povinné pole | Kybernaut IČO DIČ
* @comment Pokud používáte plugin Kybernaut IČO DIČ a potřebujete mít pole IČO jako povinné, použijte tento snippet.
* @source https://kybernaut.cz/clanky/wp-multisite-maximalni-velikost-nahravaneho-souboru/
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress 5.0.2
*/
// -------------------
@vyskoczilova
vyskoczilova / wp_db_images_within_legacy_content.sql
Created Jun 18, 2018
WordPress DB: Images within legacy content
View wp_db_images_within_legacy_content.sql
/*
WordPress DB: Images within legacy content
source: https://css-tricks.com/moving-to-https-on-wordpress/
author: Jason Witt (http://jawittdesigns.com/)
*/
/* Quotes */
UPDATE wp_posts
SET post_content = ( Replace (post_content, 'src="http://', 'src="//') )
WHERE Instr(post_content, 'jpeg') > 0
@vyskoczilova
vyskoczilova / Add new user: add to wp_usersmeta.sql
Last active Feb 6, 2018
Add new user: add to wp_usersmeta
View Add new user: add to wp_usersmeta.sql
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '9999', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'), (NULL, '9999', 'wp_user_level', '10');
View Add new user: add to wp_users.sql
INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('9999', 'username', MD5('password'), 'nickname', 'email@example.com', '', '2014-11-04 00:00:00', '', '0', 'username');
@vyskoczilova
vyskoczilova / upload_max_filesize_wpmu.php
Last active Feb 19, 2018
Upload max filesize | WP Multisite
View upload_max_filesize_wpmu.php
/**
* @snippet Upload max filesize | WP Multisite
* @comment Put the correct blog id number in the if condition. Currently set to the main blog.
* @source https://kybernaut.cz/clanky/wp-multisite-maximalni-velikost-nahravaneho-souboru/
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress Multisite 4.9
*/
// -------------------
function custom_filter_fileupload_maxk( $maxk ) {
@vyskoczilova
vyskoczilova / tax_placeholders_for_price_display_suffix.php
Last active Jun 19, 2020
Tax placeholders for Price Display Suffix
View tax_placeholders_for_price_display_suffix.php
<?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
*/
// -------------------
@vyskoczilova
vyskoczilova / woocommerce-stock-filter-for-wordpress-admin.php
Last active Nov 18, 2020
WooCommerce add stock filter to WordPress Admin (Products)
View woocommerce-stock-filter-for-wordpress-admin.php
/**
* @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
*/
// -------------------
@vyskoczilova
vyskoczilova / WooCommerce check Billing phone against pattern
Created May 10, 2017
WooCommerce check Billing phone against pattern
View WooCommerce check Billing phone against pattern
add_filter( 'woocommerce_checkout_fields' , 'wc_kbnt_override_checkout_fields' );
function wc_kbnt_override_checkout_fields( $fields )
{
$fields['billing']['billing_phone']['custom_attributes'] = array( "pattern" => "^\+?{1}[0-9 ]{9,17}$" );
return $fields;
}