This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

woocommerce sidebar on particular page

  • Creator
    Topic
  • #18376
    vtheme
    Participant

    HI

    I am aware of the settings in the Woocommerce patch, but am trying to just override all setting for a particular page and not getting the result I hoped for.

    In the patch settings, I have woocommerce default for all options.

    I am wanting to set full_width on one particular woocommerce page by adapting the code from:
    http://support.themeblvd.com/forums/topic/woocommerce-full-width-product-page/

    to this:

    function my_woocommerce_catalog_sidebar_layout( $sidebar_layout ){
    	
    	global $post;
    	
    	// Only run if WooCommerce plugin is installed
    	if( function_exists( 'is_woocommerce' ) ) {
    
               if( is_product('18013') ) {   /* our-fall-catalog */
                  echo' 18013'; 
                  $sidebar_layout = 'full_width'; 
                   echo ' '.$sidebar_layout;
                 }
     
    	}
    		
    	return $sidebar_layout;
    }
    remove_filter( 'themeblvd_sidebar_layout', 'tb_woocommerce_sidebar_layout' );
    add_filter   ( 'themeblvd_sidebar_layout', 'my_woocommerce_catalog_sidebar_layout' );

    I know that I am getting into the loop by the echo results, but the sidebar is still showing.

    Do you see anything I am doing incorrectly here?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #18382
    Jason Bobich
    Keymaster

    If this is in your functions.php just like that it won’t override the WooCommerce patch plugin because these filters are added within a function hooked to “after_setup_theme” — which proceeds what you’re doing.

    In other words, when you do the following, you’re not actually removing anything:

    remove_filter( 'themeblvd_sidebar_layout', 'tb_woocommerce_sidebar_layout' );

    And then when you do this:

    add_filter ( 'themeblvd_sidebar_layout', 'my_woocommerce_catalog_sidebar_layout' );

    … you’re adding your filter at default priority 10, but then that’s getting overridden by the filter added by the plugin.

    Try setting your filter up like this:

    function my_woocommerce_catalog_sidebar_layout( $sidebar_layout ) {
    	// ...
    }
    add_filter( 'themeblvd_sidebar_layout', 'my_woocommerce_catalog_sidebar_layout', 11 );
    #18384
    vtheme
    Participant

    Yep, that worked …. ahh what a second pair of eyes and a load more knowledge would bring me….

    There was a loss in the color of some of the added text in my custom woo page, but that is an easy adjustment.

    Thanks so very much for the help and for always giving us some background to help us understand things better!!

    #18385
    vtheme
    Participant

    whoops, I probably spoke too soon.

    I am seeing some weird things on the custom product page that I have added.
    1. I lose the color attribute for the text
    2. I lose the class=”themeblvd-lightbox mfp-image” on my thumbnails on that page
    3. the footer text on that page is not in the usual color
    4. the text on the footer bar is missing…

    I suppose this has to do with timing on things… but do you see any pattern here for a fix?

    #18737
    vtheme
    Participant

    Disregard the last post – I got things working now. Thanks for heading me in the right direction.

    #18741
    Jason Bobich
    Keymaster

    Apologies I never saw that follow up post a few weeks ago. I only saw where you said it worked.

    #18743
    vtheme
    Participant

    No problem – I always appreciate your quality themes and support.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The forum ‘Akita Responsive WordPress Theme’ is closed to new topics and replies.