Skip to content

Instantly share code, notes, and snippets.

Avatar

Karolína Vyskočilová vyskoczilova

View GitHub Profile
@vyskoczilova
vyskoczilova / enhanced_has_block_functional.php
Last active Apr 14, 2021
Enhanced has_block() function.
View enhanced_has_block_functional.php
<?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
@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 / parse_utm_codes_by_JS.js
Created Nov 13, 2020
Parse UTM codes to Contact Form 7 by javascript
View parse_utm_codes_by_JS.js
/**
* 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/
*/
@vyskoczilova
vyskoczilova / theme-guard.php
Created Oct 9, 2020
Check if theme exists and is active or die
View theme-guard.php
<?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
@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 / pre-push
Last active Mar 16, 2020
Pre-push confirmation
View pre-push
#!/bin/sh
# An additional confirmation if you really want to push to remote (prevents accidental pushes).
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# Information about the commits which are being pushed is supplied as lines to
@vyskoczilova
vyskoczilova / add-admin-user.php
Last active Jan 11, 2020
Přidat uživatele s administrátorskými právy pomocí PHP
View add-admin-user.php
<?php
/**
* @snippet Přidání uživatele s administrátorskými právy. Obsah souboru ideálně vložte do mu-plugins/add-admin-user.php a po vytvoření uživatele odstraňte z vwebu.
* @source https://kybernaut.cz/?p=3070
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress 5.3
*/
add_action( 'init', function () {
View keybase.md

Keybase proof

I hereby claim:

  • I am vyskoczilova on github.
  • I am vyskocilova (https://keybase.io/vyskocilova) on keybase.
  • I have a public key whose fingerprint is 6A45 DE74 18D7 0694 AC1D 1F39 FAF6 7F1C 5A13 0C66

To claim this, I am signing this object:

@vyskoczilova
vyskoczilova / sledovaci_kod_do_hlavicky.php
Last active Oct 8, 2019
Sledovaccí kód do hlavičky
View sledovaci_kod_do_hlavicky.php
<?php // smažte tento řádek
/**
* @snippet Vložení google analytics / hotjar sledovacího kódu přímo do hlavičky vaší šablony
* @source https://kybernaut.cz/?p=2804
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress 5.2
*/
// -------------------
add_action('wp_head', 'mojesablona_sledovaci_kod');
@vyskoczilova
vyskoczilova / woocommerce_delka_telefonniho_cisla.php
Last active Sep 5, 2019
WooCommerce: délka telefonního čísla
View woocommerce_delka_telefonniho_cisla.php
<?php // nekopírujte tento řádek
/**
* @snippet WooCommerce: Minimální délka telefonního čísla
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress 5.2 & WooCommmerce 3.7.0
*/
// -------------------
function my_theme_validate_phone( $fields, $errors ){