Skip to content

Instantly share code, notes, and snippets.

Avatar

Karolína Vyskočilová vyskoczilova

View GitHub Profile
@vyskoczilova
vyskoczilova / remove_from_the_archive_tittle.php
Last active Nov 28, 2017
WP - Remove “Category:”, “Tag:”, “Author:” from the_archive_title
View remove_from_the_archive_tittle.php
<?php
add_filter( 'get_the_archive_title', function ($title) {
// archiv rubriky
if ( is_category() ) {
$title = single_cat_title( '', false );
// archiv štítku
} elseif ( is_tag() ) {
@vyskoczilova
vyskoczilova / replace_from_the_archive_tittle.php
Last active Jul 10, 2016
WP - Replace“Category:”, “Tag:”, “Author:” from the_archive_title
View replace_from_the_archive_tittle.php
<?php
add_filter( 'get_the_archive_title', function ($title) {
// archiv rubriky
if ( is_category() ) {
$title = single_cat_title( 'Archiv rubriky' , false );
// archiv štítku
} elseif ( is_tag() ) {
@vyskoczilova
vyskoczilova / wordpress-remove-seo-columns.php
Last active Dec 3, 2017 — forked from chuckreynolds/wordpress-remove-seo-columns.php
remove WordPress SEO columns from admin post tables
View wordpress-remove-seo-columns.php
<?php
function my_manage_columns( $columns ) {
// remove the Yoast SEO columns
unset( $columns['wpseo-score'] );
unset( $columns['wpseo-title'] );
unset( $columns['wpseo-metadesc'] );
unset( $columns['wpseo-focuskw'] );
unset( $columns['wpseo-score-readability'] );
View svatek-shortcode
<?php
add_shortcode( 'kbnt_svatek', 'kybernaut_svatek' );
View WorsPress Snippet: Search - number of posts per page.php
<?php
function change_wp_search_size($query) {
if ( $query->is_search ) // Make sure it is a search page
$query->query_vars['posts_per_page'] = 10; // Change 10 to the number of posts you would like to show
return $query; // Return our modified query variables
}
add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom function onto the request filter
@vyskoczilova
vyskoczilova / Phone number not required in WooCommerce checkout
Last active May 7, 2017
Make the phone number not required in WooCommerce checkout
View Phone number not required in WooCommerce checkout
add_filter( 'woocommerce_billing_fields', 'wc_kbnt_filter_phone', 10, 1 );
function wc_kbnt_filter_phone( $address_fields ) {
$address_fields['billing_phone']['required'] = false;
return $address_fields;
}
@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;
}
@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 / 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
*/
// -------------------