I've installed Woocommerce into a theme however as it wasn't configured for Woocommerce I'm running into a problem.

Client wants a sidebar to show catagories so I'm trying to pull in Woocommerce Layered Nav.

As the page wasn't displaying the nav I followed instructions online to make a woocommerce.php file that would override page.php. The code works to allow the space for the sidebar but currently it's pulling in nothing.

Any help would be greatly appreciated.

I have spent 20+ hours trying to fix this and created the code below, as I'm stuck at a roadblock I'm unsure how I could do more research before asking this question.

<pre><?php get_header(); $page_title = get_post_meta( get_the_ID(), 'magicreche-page-title', true );</pre> if( $page_title == 'enabled' ) { ?>

<header><?php the_title( '<h1>', '</h1>' ); ?></header><?php} ?><div class="container">

<div class="row">

    <div class="col-sm-4 sidebar"><?php get_sidebar(); ?></div>

    <article id="<?php echo esc_attr(getMagicrechePageID($section_page->ID)); ?>" <?php post_class('col-sm-8'); ?>>

    <?php woocommerce_content(); ?>

</div></div><?php get_footer(); ?>
  • Plugin specific questions are off-topic here unfortunately, I'd ask woo commerce support. Nov 5, 2014 at 20:34
  • I have asked the theme author, I have asked the Woothemes plugin support and here was my third chance. It's been two weeks and I've been unable to solve this shenanigans, if you can tell how desperate I am then that's fine, because I am.
    – Feeona
    Nov 5, 2014 at 20:39
  • Removed the downvote and added an answer, hope that helps. Been there with the frustration stuff, good luck. Nov 5, 2014 at 21:15

1 Answer 1


While this question is probably technically off topic since it relates to woo, there's definitely some stuff that could be answered that will help other users in the future, plus, I really have been there with the multi-day frustration stuff and would have killed for a life line.

There's a few things at play here, what you're looking at in the code you posted is a template file, straight forward enough. The sidebar is "appearing" because that file calls get_sidebar(). I'm simplifying, but what that function does is essentially include the contents of another file based on what you pass it. Because it's being passed nothing, it is almost certainly including sidebar.php from your theme.

In sidebar.php, there should be a call to the function dynamic_sidebar(). The entire contents of sidebar.php make up "the sidebar", meaning all the markup, any static content, etc. dynamic_sidebar(), depending on what you pass it, will look for a particular widgetized area. You can see the defined widgetized areas in your theme by going to Appearance > Widgets in the admin section. Woocommerce, when installed, should include several widgets, one of which is the Woocommerce Layered Nav your client wants.

Each area in the admin section is created on the fly by the theme or by plugins by calling the function register_sidebar(). When that function is called, it's passed an array that can contain a name and/or an id, among many other things. That name or id is what you pass to dynamic_sidebar(). For example, I could register a sidebar in my functions.php like so:

register_sidebar( array(
    'id' => 'left-sidebar'
    'name' => 'Left Sidebar'
) );

That would create a widgetized area in the admin section called "Left Sidebar" that I could drop widgets into.

Then, in any file, but usually a sidebar, you call it with dynamic_sidebar().

dynamic_sidebar( 'left-sidebar' );

If, when you find sidebar.php, and it doesn't have a call to dynamic_sidebar(), then that file is not calling a widgetized area, and you'll need to do your own register_sidebar(), drop the widget into the right area under Appearance > Widgets and then call that area by adding dynamic_sidebar() to appropriate file.

  • 3
    Thank you so much! What an amazing detailed walkthrough and explanation and should help me sort this out. You can smile in the knowledge that you've lifted a whole lot of stress from my shoulders, thank you again!
    – Feeona
    Nov 5, 2014 at 22:12
  • Sure, happy to help, let me know if you're not able to figure it out. It might be worth changing the title of the question since this isn't necessarily specific to woo and it would probably help future users searching who have similar questions. Happy coding! Nov 6, 2014 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.