- This topic is empty.
-
AuthorPosts
-
November 22, 2022 at 5:06 pm #599
Billy
GuestWhat is the fastest way to support WooCommerce in a WP theme I’m developing, will it just use the index.php if no Woo templates exist?
November 22, 2022 at 5:07 pm #600Stephanie
GuestTechnically you can get away with only adding a snippet to
functions.phpif you want that defines your main content wrapper:https://woocommerce.com/document/woocommerce-theme-developer-handbook/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
Then:
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>'; }November 22, 2022 at 5:09 pm #601James
GuestIf you prefer adding a theme file you can add
woocommerce.phpwhich is a catch-all file for Woo. Copy over yourpagetemplate into a new file with that name and then replace the WordPress loop with the Woo loop which is:<?php woocommerce_content(); ?>
And save.
November 22, 2022 at 5:10 pm #602November 27, 2022 at 12:39 pm #650Jeffrey
GuestIf you’re going to use the “shortcut” methods mentioned on this thread it’s g
fine and actually recommended, however be sure to learn how to customize WooCommerce CSS.Mastering the CSS can be more useful than generating dozens of theme files.
December 16, 2022 at 12:00 pm #796Janice
GuestMastering the CSS
ah yes that is chapter 3 in Mastering los Interwebz
-
AuthorPosts