Jump to content

remove sidebar from all pages


Recommended Posts

This can be done using hooks.

As an example, to remove the 'Categories' sidebar create a file in ~/includes/hooks then add the code below

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $SecondarySidebar)
{
   if(!is_null($SecondarySidebar->getChild('Categories'))){
               $SecondarySidebar->removeChild('Categories');
   }
}); 

You can find more information on hooks here: https://developers.whmcs.com/hooks/getting-started/

Link to comment
Share on other sites

If you wanted to remove the sidebars and then stretch the content out to be full width on cart pages, you can use the hook below written by brian! 
To show the sidebar on any of the cart pages, you would need edit the $validtemplates array

<?php

# Cart Sidebar Removal / Resizing v8.1 Hook
# Written by brian!

function cart_remove_sidebars_hook($vars)
{	
	$validtemplates = array("domainregister");
	if ($vars['inShoppingCart'] && !in_array($vars['templatefile'],$validtemplates)) {
		$head_return = "<style>#order-standard_cart .cart-body { width:100% !important; }
		.cart-sidebar {display: none;}</style>";
		return $head_return;
	}
}
add_hook("ClientAreaHeaderOutput",1,"cart_remove_sidebars_hook");

Original post can be found here:

 

Link to comment
Share on other sites

Only add the pages you want a sidebar to show into the array. So in the hook that was supplied, the sidebar would be hidden on all pages except the domain register page.

Which version of WHCMS are you using? I've tested this hook in WHCMS 8.2 and is working as expected.

Link to comment
Share on other sites

Version: 8.1.3

I have put the below code in hooks

<?php

# Cart Sidebar Removal / Resizing v8.1 Hook
# Written by brian!

function cart_remove_sidebars_hook($vars)
{
//      $validtemplates = array("domainregister","domaintransfer");
        if ($vars['inShoppingCart'] && !in_array($vars['templatefile'],$validtemplates)) {
                $head_return = "<style>#order-standard_cart .cart-body { width:100% !important; }
                .cart-sidebar {display: none;}</style>";
                return $head_return;
        }
}
add_hook("ClientAreaHeaderOutput",1,"cart_remove_sidebars_hook");

So that it will work for all the pages.

Link to comment
Share on other sites

1 minute ago, Deepu3110 said:

but its not working with my WHMCS, what is the issue?

Try clearing your browser cache and template cache within WHMCS (Utilities > System > System Cleanup > Empty Template Cache). Try disabling any custom themes or hooks to rule out a conflict. If you're still having issues it might be worth reaching out to WHMCS support for additional support. 

 

Link to comment
Share on other sites

34 minutes ago, HostingMe said:

If you're still having issues it might be worth reaching out to WHMCS support for additional support

Not sure if they'd support custom code and hooks/themes. Most often the advice would be to disable both and see if it works without them, then put them back one by one until it breaks.

Link to comment
Share on other sites

Older versions of the Six theme use different CSS classes for the cart body. You could try changing the <style> part in the hook to the code below which worked in WHMCS v.7.10

<style>#order-standard_cart .pull-md-right { width:100%; } .sidebar {display: none;}</style>

If that still does not work, you'll need to find out what class the theme is using and changing the hook to match. 

Link to comment
Share on other sites

14 minutes ago, HostingMe said:

Older versions of the Six theme use different CSS classes for the cart body. You could try changing the <style> part in the hook to the code below which worked in WHMCS v.7.10


<style>#order-standard_cart .pull-md-right { width:100%; } .sidebar {display: none;}</style>

If that still does not work, you'll need to find out what class the theme is using and changing the hook to match. 

Thank you so muchhhhhhhhh!!!

Link to comment
Share on other sites

You should be able to do this via CSS. If you create a custom.css file at ~/templates/six/css/ (replace 'six' with the name of your theme) then add the below that should do it.

@font-face {font-family: "Prometo"; src: url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.eot"); src: url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.eot?#iefix") format("embedded-opentype"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.woff2") format("woff2"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.woff") format("woff"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.ttf") format("truetype"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.svg#Prometo") format("svg");}
h1{font-family:Prometo!important;}

 

Edited by HostingMe
Link to comment
Share on other sites

9 hours ago, HostingMe said:

You should be able to do this via CSS. If you create a custom.css file at ~/templates/six/css/ (replace 'six' with the name of your theme) then add the below that should do it.


@font-face {font-family: "Prometo"; src: url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.eot"); src: url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.eot?#iefix") format("embedded-opentype"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.woff2") format("woff2"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.woff") format("woff"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.ttf") format("truetype"), url("//db.onlinewebfonts.com/t/22b227f39427a4be79eff76ad0abdeb4.svg#Prometo") format("svg");}
h1{font-family:Prometo!important;}

 

Thank you its work fine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated