Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I cannot get the sidebar on my WP site (twenty-eleven theme) working properly in my wp e-commerce shop. On the products page the sidebar is on the right side of the page, as it should be. On a single products page, however, the content of the sidebar is showing below the content. Have spend many hours searching how to fix this but no luck. Any help would be greatly appreciated.

Here's a link to a single productpage: http://test.boarddesign.nl/?wpsc-product=gopro-kite-line-mount Sidebar is below the content

Here's a link tot a correct page: http://test.boarddesign.nl/?page_id=43

share|improve this question
    
what have you done to get a sidebar into the single products page? –  Michael Nov 23 '12 at 13:11

2 Answers 2

In the twenty-eleven theme there is a body_class filter that adds a "singular" class that it uses for some of the styles and those styles seem to be expecting there to be no right sidebar.

Here is code you can use in a child theme (rather than making modifications directly to the function in twenty-eleven). Add this to the child theme's functions.php, to remove the twenty-eleven filter and use a customized version instead, that adds !wpsc_is_single_product() to the if statement:

/**
 * Changes the body classes function of twentyeleven to exclude wpsc single product pages from getting singular class
 */
function my_child_body_classes( $classes ) {

    if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
        $classes[] = 'single-author';

    if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) && ! wpsc_is_single_product() )
        $classes[] = 'singular';

    return $classes;
}

/**
 * remove twentyeleven filter and add custom filter
 */
function my_child_change_body_classes() {
    remove_filter( 'body_class', 'twentyeleven_body_classes' );
    add_filter( 'body_class', 'my_child_body_classes' );
}
add_action( 'init', 'my_child_change_body_classes' );
share|improve this answer

I don't even have a dev environment setup with the Twenty Eleven theme installed so can't be 100% certain about this; but looking at your site it appears that the single product page is using the Twenty Eleven single column layout. Which in this case means that the main content is centered in the page, thus pushing your sidebar down.

You have a few options here:

  1. Check your 'store' page, if it's set to single column change it to your default layout.
  2. Customize the styling for the single page to override the 'margin: 0;' on the singular element. Risky because it more than likely will impact other pages as well.
  3. Use WP e-commerce custom theme options to adjust your individual pages.

For an overview of WP e-commerce customization take a look at the WP e-Commerce Plugin Documentation site.

share|improve this answer
    
Thanks for your reply. 1. The 'store' page is set up using the sidebar template. That is why the store itself is looking fine with sidebar. But the single-products page is not! 2. Hmm, I'm not too comfortable with that option but maybe I should try that 3. I will have a look into that. Meanwhile, all other solutions are welcome! –  Ben Nov 23 '12 at 15:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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