dev_in_prog
dev_in_prog

Reputation: 121

How to delete the Navigation Menu title in liferay theme?

I created a theme and copied the navigation.ftl from Liferay Classic Theme but in my theme, The navigation title is showing up as shown in the below screen-shot.

enter image description here

If I am logged in as an Administrator, I am able to edit the text and make it blank and Save and it goes away. But when i refresh the page, it comes back which i think is a bug.

But my question is, What do i do in the theme so that the title doesn't show up at all anywhere.

The code snippet from navigation.ftl

<#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId",     "barebone") />

<div aria-expanded="false" class="collapse navbar-collapse" id="navigationCollapse">
<#if has_navigation && is_setup_complete>
    <nav class="${nav_css_class} site-navigation" id="navigation" role="navigation">
        <div class="navbar-right">
            <@liferay.navigation_menu default_preferences="${freeMarkerPortletPreferences}" />
        </div>
    </nav>
</#if>
</div>

<#assign VOID = freeMarkerPortletPreferences.reset() />

Upvotes: 2

Views: 1537

Answers (2)

LIannotti
LIannotti

Reputation: 382

I had the same issue and found that in my custom theme (starting from the Styled theme using the Theme Generator) the portlet.ftl file had the line:

    <h2 class="portlet-title-text">${portlet_title}</h2>

The portlet.ftl in the Classic theme has:

    <#if portlet_display.getPortletDecoratorId() != "barebone">
        <h2 class="portlet-title-text">${portlet_title}</h2>
    </#if>

I added that #if statement around the h2 to my portlet.ftl and now the title is not displayed if Barebone is the chosen decorator for a portlet. This works whether Barebone is set through a template or through the Look and Feel menu in the admin.

Upvotes: 2

dev_in_prog
dev_in_prog

Reputation: 121

I was able to hide the title (of Navigation Menu portlet) using the following CSS in my custom theme

.portlet-static.portlet-static-end.portlet-barebone.portlet-navigation .portlet-content.portlet-content-editable .portlet-title-text { display:none !important; }

Edit: The above solution worked when I logged in as an Administrator only.

I replaced it with the following to hide it for Regular users as well:

section#portlet_com_liferay_site_navigation_menu_web_portlet_SiteNavigationMenuPortlet.portlet h2.portlet-title-text { display:none !important; }

Upvotes: 0

Related Questions