Sunday, May 26, 2019 7:03:07 AM

How to Hide the homepage control only on homepage, keeping the Homepage control in other pages.

5 years ago
#1372 Quote
Hi support, i would like to be able to implement this solution on my Healthy Theme, I'm currently had done it successfully on a dev project with Nop-template megamenu plugin and it works fantastic, however with Healthy theme the code need a little rewrite.
See below:

1.) Modify the Mega Menu view and add a css class "home" to the Home page link li element.
Here is the view file:

Plugins\SevenSpikes.Nop.Plugins.MegaMenu\Views\MegaMenu\MegaMenu.cshtml

the code:

@if (Model.Settings.IncludeHomePageLink)
        {
            <li class="home">
                <a href="@Url.RouteUrl("HomePage")">@T("HomePage")</a>
            </li>
        }



2.) Create a new css file that will contain the "home" class properties.
(i.e) I created a new css class in Visual Studio called MegaMenuHome.css  style it, and placed under
"C:\Users\jusername\Documents\Visual Studio 2012\Projects\projName\Presentation\Nop.Web\Plugins\SevenSpikes.Nop.Plugins.MegaMenu\Themes\00044\Content\...(style file)..

.mega-menu .home
{
display: none !important;
}


3. Link the file in the Views\Home\Index.cshtml file.
Html.AppendCssFileParts("~/the path to your file here/homestyle.css");
example:
Html.AppendCssFileParts("~/Plugins/SevenSpikes.Nop.Plugins.MegaMenu/Themes/00044/Content/MegaMenuHome.css");

This way the Home link will not be displayed only on the home page as the styles that hide it will be loaded only on the Home page.

0
5 years ago
#1373 Quote
Hello,
I don't think you should create additional css file for one element only.

Try just add next code on Home/Index.cshtml


<style type="text/css">.mega-menu .home{display:none;}</style>
0
Thank you for choosing our products!
We have something for you :)