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
add_filter( 'wp_calculate_image_sizes', 'pk_content_archive_thumbnail_image_sizes', 10, 5 ); | |
/** | |
* Change the default "sizes" attribute created by WordPress | |
* for the content archive thumbnails | |
*/ | |
function pk_content_archive_thumbnail_image_sizes( $sizes, $size, $image_src, $image_meta, $attachment_id ) { | |
if( is_archive() && is_main_query() || is_home() ) { | |
$sizes = '(max-width: 600px) 100vw, 50vw'; | |
} |
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
/ALL IN ONE title | |
add_filter( 'aioseop_title', 'change_wordpress_seo_title' ); | |
function change_wordpress_seo_title( $title ){ | |
$term = get_queried_object(); | |
if(!empty($term)&&$term->taxonomy=='category'){ | |
if($term->term_id==62) $title="Artykuły BHP Wrocław - Hurtownia Online ".get_bloginfo( 'name' ); | |
} | |
return $title; |
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
// add class to wp_list_categories | |
// if category has a children add cat-parent class | |
add_filter( 'category_css_class', 'add_class_to_category', 10, 4); | |
function add_class_to_category($css_classes, $category, $depth, $args) { | |
$children = get_terms( $category->taxonomy, array( | |
'parent' => $category->term_id, | |
'hide_empty' => false | |
) ); | |
// print_r($children); // uncomment to examine for debugging |
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
remove_action('wp_head', 'rel_canonical'); | |
add_action('init', function() { | |
add_filter( 'wpseo_canonical', '__return_false', 10 ); | |
}); |
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
var insta_loaded_once=false; | |
if(jQuery('.wdi_feed_wrapper').length){ | |
jQuery('#wdi_feed_0').on('wdi_feed_loaded',function(){ | |
setTimeout(function(){ | |
if(insta_loaded_once==false){ | |
var slider_insta = tns({ | |
container: '.wdi_feed_wrapper', |
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
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
// ADD NIP AND REARRANGE | |
function custom_override_checkout_fields( $fields ) { | |
$fields['billing']['pk_nip'] = array( | |
'label' => __('NIP', 'woocommerce'), | |
'placeholder' => _x('Wpisz NIP, jeżeli chcesz otrzymać fakturę', 'placeholder', 'woocommerce'), | |
'required' => false, | |
'class' => array('form-row-wide'), | |
'clear' => true, |
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
//REARRANGE PRODUCT IN NOWOŚCI TAG | |
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby'); | |
function custom_default_catalog_orderby($sort_by) { | |
if( !is_tax( 'product_tag', 'Nowości' ) ) { | |
return $sort_by; | |
} | |
return 'date'; // Can also use title and price | |
} |
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
// ADD NOWOŚĆ TAG ONA ZDJĘCIE PRODUKTÓW POWIĄZANYCH | |
add_action('woocommerce_before_shop_loop_item_title','show_novelty_on_related_products',11); | |
function show_novelty_on_related_products(){ | |
global $product; | |
if(is_product()){ | |
if( has_term( array( 'Nowości' ), 'product_tag' ,$product) ) { | |
echo '<span class="novelty">Nowość!</span>'; | |
} | |
} |
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
add_action('pods_meta_groups', 'customize_frontpage',10,2); | |
function customize_frontpage($type, $name){ | |
global $post_ID, $post_type; | |
if ( empty ( $post_ID ) or 'page' !== $post_type ) | |
return; | |
if ( $post_ID === (int) get_option( 'page_on_front' ) ){ | |
//change order and header of pods fields |