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
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
add_filter( 'woocommerce_package_rates', 'pk_woocommerce_shipping_by_weight', 9999, 2 ); | |
function pk_woocommerce_shipping_by_weight( $rates, $package ) { | |
$destination = $package['destination']; | |
$country = $destination['country']; | |
//cost sets in carbonfields for each reagions | |
$pl_shipping_costs = carbon_get_theme_option( 'pk_shipping_costs_pl' ); | |
$inter_shipping_costs = carbon_get_theme_option( 'pk_shipping_costs_inter' ); | |
$cart_weight=WC()->cart->get_cart_contents_weight(); |
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
<?php | |
// probably there is a problem with directory to carbonfield plugin. | |
// As it is shown under this url https://github.com/htmlburger/carbon-fields/issues/457 | |
// this problem appears when plugin is in symlinked directory. | |
// add below line to function.php | |
define('Carbon_Fields\URL', WP_PLUGIN_URL. '/carbon-fields/vendor/htmlburger/carbon-fields'); |
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
//carbonfields settings: | |
function pk_get_shipping_countries(){ | |
//get shipping countries for defining countries for bulky products | |
$woo_countries = new WC_Countries(); | |
$countries = $woo_countries->get_allowed_countries(); | |
return $countries; | |
} | |
function pk_get_shipping_zones(){ |
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
<?php | |
// define( 'Carbon_Fields\URL', get_parent_theme_file_path( 'vendor/htmlburger/carbon-fields' ) ); | |
// \Carbon_Fields\Carbon_Fields::boot(); | |
define('Carbon_Fields\URL', WP_PLUGIN_URL. '/carbon-fields/vendor/htmlburger/carbon-fields'); | |
use Carbon_Fields\Container; | |
use Carbon_Fields\Field; | |
function sc_get_contact_forms7(){ | |
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
<?php | |
if(is_paged()&&is_product_category()) { | |
$thisCat = get_query_var('product_cat'); | |
$category_link = get_term_link($thisCat, 'product_cat'); | |
echo '<link rel="canonical" href="' . $category_link . '" />'; | |
} | |
if(is_paged()&&is_product_tag()) { | |
$thisTag = get_query_var('product_tag'); |
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
<?php | |
/** | |
* 2007-2019 PrestaShop and Contributors | |
* | |
* NOTICE OF LICENSE | |
* | |
* This source file is subject to the Open Software License (OSL 3.0) | |
* that is bundled with this package in the file LICENSE.txt. | |
* It is also available through the world-wide-web at this URL: | |
* https://opensource.org/licenses/OSL-3.0 |
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
{assign var="aw_url" value=$smarty.server.REQUEST_URI} | |
{if strpos($aw_url,'?') !== false} | |
<meta name="robots" content="noindex, follow"> | |
{elseif $page.meta.robots !== 'index'} | |
<meta name="robots" content="{$page.meta.robots}"> | |
{/if} | |
{if $page.page_name=="category"} |