Woo-commerce
How to Make WP theme Woo-commerce Supported
In this tune I am going to describe “How to Make WP theme Woo-commerce Supported”. Sometimes wordpress ready theme which buy or created may not have woo commerce supported. In this tune steps by step describe how to make woo commerce support easily.
Step-1: Duplicate or copy page.php file and rename woocommerce.php Note: The woocommerce.php file location must be in wp-content/themes/YOURTHEME/woocommerce.php
Step-2: Open the woocommerce.php file in any editor and their found loop like start <?php if ( have_posts() ) : and end <?php endif; ?>. Delete <?php if ( have_posts() ) : to <?php endif; ?> all code and that position will be <?php woocommerce_content(); ?>
To get woo commerce default style use <div class=”woocommerce”> before the loop like below:
<div class="woocommerce"> <?php woocommerce_content(); ?> </div>
Step-3: Add below line in your theme functions.php file to remove woo commerce not supported warning.
add_theme_support( 'woocommerce' );
Now your theme supported woo commerce plugin. Without next steps your theme properly supported woo-commerce.
Step-4: To unhook the WooCommerce wrappers use below code in your theme functions.php file;
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
Step-5: Than use own hook use below code in theme function.php file.
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>'; }
For More Information click here
Comments are closed