my solution works for who makes a theme from zero (not using WordPress ready themes)
- make a Backup from your WordPress theme
- go to
wp-content/plugins/woocommerce
and find and copy a directory which name istemplates
intowp-content/themes/your-theme
and rename it towoocommerce
- in your theme directory, create a file and name it
woocommerce.php
and add these lines in it:
<!DOCTYPE html>
<html lang="en">
<head>
<?php get_header(); ?>
</head>
<body <?php body_class(); ?>>
<div class="woocommerce">
<?php woocommerce_content(); ?>
</div>
<?php get_footer(); ?>
</body>
</html>
- then add this codes to your theme
functions.php
:
<?php
function web_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_action( 'after_setup_theme', 'web_add_woocommerce_support' );
?>
note(1): be sure you have single.php
and page.php
.
note(2): be sure your <body>
tags is like this: <body <?php body_class(); ?>>