0

Hi Guys I have some problem regards removing the sidebar on my single product page,

I look for some php code to get rid of it but nothing works for me.

>     /**  * @snippet       Remove Sidebar @ Single Product Page  * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055 
> * @sourcecode    https://businessbloomer.com/?p=19572  * @author        Rodolfo Melogli  * @testedwith    WooCommerce 3.2.6  */   add_action(
> 'wp', 'bbloomer_remove_sidebar_product_pages' );   function
> bbloomer_remove_sidebar_product_pages() { if ( is_product() ) {
> remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
> } }

inserting this code on my funtion.php but nothing happens I used avada for my theme.

I manage to removed the sidebar but the products image and description stay on the right side of the page.

for more info please see image : https://ibb.co/k9qtfxB

You can check the page here: http://sumuri2.us.tempcloudsite.com/product/customize-your-workstation/

I hope someone can help me with this thank you.

1 Answer 1

0
function remove_sidebar( $is_active_sidebar, $index ) {
if( ! is_product() ) {
return $is_active_sidebar;
}
return false;
}
add_filter( 'is_active_sidebar', 'remove_sidebar', 10, 2 );
3
  • thank you I will try this one Commented Jul 10, 2019 at 15:41
  • 1
    hi I used the code you gave to me this is the error while saving. Your PHP code changes were rolled back due to an error on line 48 of file wp-content/themes/Avada-Child-Theme/functions.php. Please fix and try saving again. syntax error, unexpected '”' (T_STRING) line 48 is referring for this code: if( $index !== “sidebar-1” ) Commented Jul 10, 2019 at 15:44
  • if you remove ( $index !== “sidebar-1” ) this line it will also work i have tested it and please check if you copied that code single quote and double quote is proper on your editor, i have edited code add this code and check Commented Jul 11, 2019 at 11:56

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.