WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Woocommerce custom theme (3 posts)

  1. holy88
    Member
    Posted 9 months ago #

    Hi i've a problem with Woocommerce and integration in my theme (white-Rock from themeforest), i found a fix but i don't know how to use it,

    The problem: woocomerce product page and single product page use the blog page template by default

    The Fix:

    By inserting a few lines in your theme’s functions.php file, First unhook the WooCommerce wrappers;

    remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
    remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

    Then hook in your own functions to display the wrappers your theme requires;

    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 '';
    }

    function my_theme_wrapper_end() {
    echo '';
    }

    Make sure that the markup matches that of your theme. So for white-rock theme, I replaced "main" with "container-sidebar".

    I've tryed to modify the functions.php of my template but really i don't know how, or better i've tryed but it didn't worked :/ can anyone help me to apply the fix :) ?

    thanks

    http://wordpress.org/extend/plugins/woocommerce/

  2. jameskoster
    Member
    Plugin Author

    Posted 9 months ago #

    Hi Holy,

    If you're struggling using hooks, why not give the woocommerce.php method a shot? It's much simpler.

    Thanks

  3. holy88
    Member
    Posted 9 months ago #

    HI thanks! I've tryed to make a

    woocommerce.php file in my own template directory like:

    site/wp-content/themes/whiterock/
    woocommerce.php:

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package progression
     * @since progression 1.0
     */
    
    get_header(); ?>
    <?php woocommerce_content(); ?>
    <?php get_footer(); ?>

    But nothing is changed, is the code wrong?
    The original page.php is:

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package progression
     * @since progression 1.0
     */
    
    get_header(); ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
    	<?php the_content(); ?>	
    
    	<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'progression' ), 'after' => '</div>' ) ); ?>
    <?php endwhile; // end of the loop. ?>		
    
    <?php if(of_get_option('page_comments_default', '0')): ?><?php comments_template( '', true ); ?><?php endif; ?>
    
    <?php get_footer(); ?>

    Thanks :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.