Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function my_theme_enqueue_styles() {
- $parent_style = 'mesmerize';
- wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
- wp_enqueue_style( 'child-style',
- get_stylesheet_directory_uri() . '/style.css',
- array( $parent_style ),
- wp_get_theme()->get('Version')
- );
- }
- add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
- //css na stronach kategorii
- function add_category_css() {
- if (is_product_category()) {
- wp_enqueue_style( 'category-style', get_stylesheet_directory_uri() . '/category_style.css' );
- }
- }
- add_action( 'wp_enqueue_scripts', 'add_category_css' );
- // Disable Ajax Call from WooCommerce
- add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
- function dequeue_woocommerce_cart_fragments() { if (is_front_page()) wp_dequeue_script('wc-cart-fragments'); }
- //usuniecie 'cart content' , opcji sortowania, koszyka oraz liczba wynikow wyszukiwania
- remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
- remove_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );
- remove_action( 'woocommerce_before_shop_loop' , 'woocommerce_catalog_ordering', 30 );
- remove_action( 'woocommerce_before_shop_loop' , 'woocommerce_result_count', 20 );
- remove_action( 'woocommerce_before_shop_loop', 'mesmerize_woocommerce_cart_button', 20);
- remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_breadcrumb', 21);
- remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 21);
- //usuniecie okruszkow z strony glownej produktow; na pozostalych stronach zmiana linku
- add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url_shop' );
- function woo_custom_breadrumb_home_url_shop() {
- if ( is_shop() ) {}
- else
- {return 'http://redats.pl/produkty/';}
- }
- //zmiana nazwy linku strony glownej produktow
- add_filter( 'woocommerce_breadcrumb_defaults', 'change_breadcrumb_home_text' );
- function change_breadcrumb_home_text( $defaults ) {
- $defaults['home'] = 'Produkty';
- return $defaults;
- }
- //usuniecie zawartosci koszyka
- remove_action ('woocommerce_content','get_cart_contents_count',10);
- //zmiana nazwy SKU
- function translate_woocommerce($translation, $text, $domain) {
- if ($domain == 'woocommerce') {
- switch ($text) {
- case 'SKU':
- $translation = 'Kod produktu';
- break;
- case 'SKU:':
- $translation = 'Kod produktu:';
- break;
- }
- }
- return $translation;
- }
- add_filter('gettext', 'translate_woocommerce', 10, 3);
- //dodanie skrytpu dodajacego link do obrazka z reklama na stronie glownej
- //function ts_add_link() {
- //if( is_front_page() ) {
- //wp_register_script('my_amazing_script', 'https://redats.phu-szczepan.pl/wp-content/plugins/add_link.js', array('jquery'),'1.1', true);
- //wp_enqueue_script('my_amazing_script');
- //}
- //}
- //add_action( 'wp_enqueue_scripts', 'ts_add_link' );
- //usuni�cie tytu��w stron w kategoriach
- add_filter('woocommerce_product_description_heading', '__return_null');
- add_filter('woocommerce_product_additional_information_heading', '__return_null');
- add_filter( 'yikes_woocommerce_custom_repeatable_product_tabs_heading', '__return_false' );
- // Zmiana polozenia przycisku 'przejdz do sklepu'
- remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
- add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 60 );
- //zmiana po�o�enia kart z opisem
- remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
- add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 40 );
- //Linia hr pod drzewkiem kategorii
- function add_hr() {
- if (is_product()){
- echo '<hr>';}
- }
- add_action( 'woocommerce_before_single_product_summary', 'add_hr', 9);
- //Przesuni�cie powi�zanych produkt�w ni�ej
- remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
- add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 65 );
- //Usuniecie boxa 'Promocja'
- add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash');
- function woo_custom_hide_sales_flash()
- {
- return false;
- }
- // zezw�l na HTML w opisach kategorii i tag�w
- foreach ( array( 'pre_term_description' ) as $filter ) {
- remove_filter( $filter, 'wp_filter_kses' );
- }
- foreach ( array( 'term_description' ) as $filter ) {
- remove_filter( $filter, 'wp_kses_data' );
- }
- //usuni�cie kodu produktu z karty produktu
- function remove_product_page_sku( $enabled ) {
- if ( ! is_admin() && is_product() ) {
- return false;
- }
- return $enabled;
- }
- add_filter( 'wc_product_sku_enabled', 'remove_product_page_sku' );
- //zmiana wygl�du kategorii
- remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
- //add_action( 'woocommerce_before_shop_loop', 'woocommerce_taxonomy_archive_description', 20);
- //add_action ('woocommerce_before_shop_loop', 'rebuild_archive_page',35);
- //function rebuild_archive_page() {
- //if (is_product_category()) {
- //echo '<hr>';
- //if (is_product_category('wywazarki')){
- //echo 'test';
- //}
- // }
- //}
- //dodanie obrazka g��wnego kategorii oraz opisu
- add_action( 'woocommerce_before_shop_loop', 'woocommerce_category_image_and_description', 30 );
- function woocommerce_category_image_and_description() {
- if ( is_product_category() ){
- global $wp_query;
- $cat = $wp_query->get_queried_object();
- $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
- $image = wp_get_attachment_url( $thumbnail_id );
- if ( $image ) {
- echo '<div id="content-12" class="content-2 content-section content-section-spacing" style="background-color: #ffffff;" data-label="Content" data-id="content-2" data-export-id="content-2" data-category="content">
- <div>
- <div class="row middle-xs">
- <div class="col-sm-5">
- <img class="category-img" src="' . $image . '" alt="' . $cat->name . '" >
- </div>
- <div class="col-sm-7 full-col-left-padding full-col-right-padding">
- <div class="row">
- <div class="space-bottom-small content-title-col" data-type="column">
- ' . $cat->description . '
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>';
- }
- }
- }
- //tytu� kategorii pod opisem kategorii
- add_action ('woocommerce_before_shop_loop', 'ts_add_title',55);
- function ts_add_title () {
- if ( ! is_shop() ) {
- echo '<hr>';
- echo '<h3>Produkty z tej kategorii:</h3>';
- }
- }
- //usuni�cie cen z produkt�w
- remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
- //usuni�cie meta z produkt�w
- remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
- //Przeniesienie tytu�u produktu nad zdjecie
- remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
- add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_title', 10 );
- //Zmiana tekstu pokrewnych produkt�w
- function my_text_strings( $translated_text, $text, $domain ) {
- switch ( $translated_text ) {
- case 'Pokrewne produkty' :
- $translated_text = __( 'Zobacz inne modele', 'woocommerce' );
- break;
- }
- return $translated_text;
- }
- add_filter( 'gettext', 'my_text_strings', 20, 3 );
- add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
- function woo_rename_tabs( $tabs ) {
- $tabs['additional_information']['title'] = __( 'Parametry' ); // Rename the additional information tab
- return $tabs;
- }
- // REMOVE WP EMOJI
- remove_action('wp_head', 'print_emoji_detection_script', 7);
- remove_action('wp_print_styles', 'print_emoji_styles');
- remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
- remove_action( 'admin_print_styles', 'print_emoji_styles' );
- //zmiana tekstu copyright
- add_filter('mesmerize_get_footer_copyright', 'change_copyrightText', 10,1) ;
- function change_copyrightText( $copyrightText ){
- $copyrightText = __('<p class="copyright">© 2018 Redats.pl Wszelkie prawa zastrzeżone przez P.H.U. Szczepan. Zakaz kopiowania i używania materiałów bez zgody właściciela.</p>', 'mesmerize');
- return $copyrightText;
- }
- //dodanie skryptu analytics
- function add_analytics_script() {
- if ( ! is_user_logged_in() ) {
- ?>
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-112378455-1"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
- gtag('config', 'UA-112378455-1');
- </script>
- <?php
- }
- }
- add_action( 'wp_head', 'add_analytics_script', 99 );
- remove_action("storefront_homepage_after_product_categories", "__return_null");
- /* Exclude Category from Shop*/
- add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
- function get_subcategory_terms( $terms, $taxonomies, $args ) {
- $new_terms = array();
- // if a product category and on the shop page
- if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() && is_shop() ) {
- foreach ( $terms as $key => $term ) {
- if ( ! in_array( $term->slug, array( 'podnosniki-plytowe' ) ) ) {
- $new_terms[] = $term;
- }
- }
- $terms = $new_terms;
- }
- return $terms;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement