Skip to content

Instantly share code, notes, and snippets.

View vyskoczilova's full-sized avatar

Karolína Vyskočilová vyskoczilova

View GitHub Profile
@vyskoczilova
vyskoczilova / remove_from_the_archive_tittle.php
Last active November 28, 2017 10:02
WP - Remove “Category:”, “Tag:”, “Author:” from the_archive_title
<?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 July 10, 2016 21:00
WP - Replace“Category:”, “Tag:”, “Author:” from the_archive_title
<?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 December 3, 2017 18:45 — forked from chuckreynolds/wordpress-remove-seo-columns.php
remove WordPress SEO columns from admin post tables
<?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'] );
<?php
add_shortcode( 'kbnt_svatek', 'kybernaut_svatek' );
add_filter( 'allow_subdirectory_install',
create_function( '', 'return true;' )
);
<?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 10:35
Make the 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 17:33
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 April 24, 2021 16:30
WooCommerce add stock filter to WordPress Admin (Products)
/**
* @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 June 19, 2020 09:48
Tax placeholders for Price Display Suffix
<?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
*/
// -------------------