SlideShare a Scribd company logo
1 of 15
Download to read offline
Jak zintegrować
WooCoomerce
z (prawie) każdym motywem?
LUTY 2016
resentation
Gdzie pojawiają się problemy?
Większość motywów WordPress jest zintegrowana
z wtyczką WooCommerce.
Czasem jednak domyślna zawartość WooCommerce
nie pasuje do wybranego motywu.
Problem pojawia się na stronie sklepu, pojedynczego
produktu lub taksonomii (kategorii, tagów).
Inne strony (koszyk, konto, kasa) używają szablonu
page.php wybranego motywu, więc problemów nie ma.
resentation
Komunikat o problemie
Po włączeniu w panelu administracyjnym WordPressa
wybranego motywu, który nie jest zintegrowany
z WooCommercem, pojawia się komunikat:
resentation
Dwa sposoby integracji
Istnieją 2 sposoby, aby rozwiązać pojawiający się problem:
Użycie funkcji woocommerce_content() w motywie
Korzystanie z hooków (dla zaawansowanych
użytkowników i programistów).
resentation
Korzystanie z woocommerce_content()
To rozwiązanie pozwala na dodanie do motywu
nowego szablonu strony dla treści związanych ze sklepem.
Wadą tego rozwiązania jest to, że mamy jeden szablon
dla wszystkich taksonomii i typów wpisów (kategorie
produktów, pojedyncze strony produktów itp.)
resentation
Kopia szablonu strony
1) Tworzymy kopię pliku page.php i zmieniamy jej nazwę
na woocommerce.php
Plik ten powinien znaleźć się:
wp-content/themes/YOURTHEME-CHILD/woocommerce.php
Ważne jest utworzenie motywu potomnego,
ponieważ podczas aktualizacji stare pliki motywów
są usuwane, a wgrywane nowe.
resentation
Wymiana pętli
2) Otwieramy nowo utworzony plik woocommerce.php
i w miejsce pętli, która rozpoczyna się zwykle
<? php if (have_posts ()):
i zazwyczaj kończy <?php endif; ?>
wstawiamy <?php woocommerce_content(); ?>
resentation
resentation
Uwaga
Utworzony w folderze motywu woocommerce.php
nie będzie w stanie zastąpić
woocommerce/archive-product.php własnego szablonu.
Ma to zapobiec problemom z wyświetlaniem.
resentation
Wykorzystanie hooków
Ta metoda jest bardziej elastyczna.
Podobnie dodawany jest WoCommerce do motywów
WooThemes.
Metoda polega na dodaniu kilku linii kodu w pliku
functions.php motywu. Pamiętajmy, żeby był to motyw
potomny.
remove_action ('woocommerce_before_main_content',
'woocommerce_output_content_wrapper', 10),
remove_action ('woocommerce_after_main_content',
'woocommerce_output_content_wrapper_end', 10);
resentation
Uwaga
Możliwe jest dokładniejsze określenie miejsca, w którym ma
pojawić się domyślna zawartość WooCommerce'a.
add_action('woocommerce_before_main_content',
'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content',
'my_theme_wrapper_end', 10);
function my_theme_wrapper_start() {
 echo '<section id="main">';
}
function my_theme_wrapper_end() {
 echo '</section>';
}
resentation
Deklaracja wsparcia dla WooCommerce
Jeżeli jesteś zadowolony z integracji, zadeklaruj
w pliku functions.php motywu wsparcie
dla WooCommerce:
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
Problem nadal istnieje
Jeśli wszystkie metody zawiodą, pozostaje wybrać
któryś z motywów, które deklarują współpracę
z WooCommerce.
Pytania?
Barbara Muszko
Pasjonatka WordPressa.
Od 2008 r. tworzę strony i sklepy internetowe
z wykorzystaniem tego systemu zarządzania treścią.
www.e-wsparcie.com.pl
e-wsparcie@e-wsparcie.com.pl

More Related Content

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Jak zintegrować WooCommerce z (prawie) każdym motywem?

  • 1. Jak zintegrować WooCoomerce z (prawie) każdym motywem? LUTY 2016
  • 2. resentation Gdzie pojawiają się problemy? Większość motywów WordPress jest zintegrowana z wtyczką WooCommerce. Czasem jednak domyślna zawartość WooCommerce nie pasuje do wybranego motywu. Problem pojawia się na stronie sklepu, pojedynczego produktu lub taksonomii (kategorii, tagów). Inne strony (koszyk, konto, kasa) używają szablonu page.php wybranego motywu, więc problemów nie ma.
  • 3. resentation Komunikat o problemie Po włączeniu w panelu administracyjnym WordPressa wybranego motywu, który nie jest zintegrowany z WooCommercem, pojawia się komunikat:
  • 4. resentation Dwa sposoby integracji Istnieją 2 sposoby, aby rozwiązać pojawiający się problem: Użycie funkcji woocommerce_content() w motywie Korzystanie z hooków (dla zaawansowanych użytkowników i programistów).
  • 5. resentation Korzystanie z woocommerce_content() To rozwiązanie pozwala na dodanie do motywu nowego szablonu strony dla treści związanych ze sklepem. Wadą tego rozwiązania jest to, że mamy jeden szablon dla wszystkich taksonomii i typów wpisów (kategorie produktów, pojedyncze strony produktów itp.)
  • 6. resentation Kopia szablonu strony 1) Tworzymy kopię pliku page.php i zmieniamy jej nazwę na woocommerce.php Plik ten powinien znaleźć się: wp-content/themes/YOURTHEME-CHILD/woocommerce.php Ważne jest utworzenie motywu potomnego, ponieważ podczas aktualizacji stare pliki motywów są usuwane, a wgrywane nowe.
  • 7. resentation Wymiana pętli 2) Otwieramy nowo utworzony plik woocommerce.php i w miejsce pętli, która rozpoczyna się zwykle <? php if (have_posts ()): i zazwyczaj kończy <?php endif; ?> wstawiamy <?php woocommerce_content(); ?>
  • 9. resentation Uwaga Utworzony w folderze motywu woocommerce.php nie będzie w stanie zastąpić woocommerce/archive-product.php własnego szablonu. Ma to zapobiec problemom z wyświetlaniem.
  • 10. resentation Wykorzystanie hooków Ta metoda jest bardziej elastyczna. Podobnie dodawany jest WoCommerce do motywów WooThemes. Metoda polega na dodaniu kilku linii kodu w pliku functions.php motywu. Pamiętajmy, żeby był to motyw potomny. remove_action ('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10), remove_action ('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
  • 11. resentation Uwaga Możliwe jest dokładniejsze określenie miejsca, w którym ma pojawić się domyślna zawartość WooCommerce'a. add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10); add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10); function my_theme_wrapper_start() {  echo '<section id="main">'; } function my_theme_wrapper_end() {  echo '</section>'; }
  • 12. resentation Deklaracja wsparcia dla WooCommerce Jeżeli jesteś zadowolony z integracji, zadeklaruj w pliku functions.php motywu wsparcie dla WooCommerce: add_action( 'after_setup_theme', 'woocommerce_support' ); function woocommerce_support() { add_theme_support( 'woocommerce' ); }
  • 13. Problem nadal istnieje Jeśli wszystkie metody zawiodą, pozostaje wybrać któryś z motywów, które deklarują współpracę z WooCommerce.
  • 15. Barbara Muszko Pasjonatka WordPressa. Od 2008 r. tworzę strony i sklepy internetowe z wykorzystaniem tego systemu zarządzania treścią. www.e-wsparcie.com.pl e-wsparcie@e-wsparcie.com.pl