Our Work

Restrict Liferay Theme scope to a Site/Community

Updated 1 month and 17 days ago

Domain: Liferay

Version: 6.1.2 CE

Module: Liferay Themes

In Liferay we can deploy any number of themes to and those are available to all the Sites and Organizations. Sometimes we want to develop/deploy theme to certain Sites/Community pages. By out of the box Liferay doesn’t provide this feature but with little additional configuration to theme xml file (liferay-look-and-feel.xml). When building Lifeay we need to add below snippet to the Liferay-look-and-feel.xml file.

<look-and-feel>
<compatibility>
<version>6.1.1+</version>
</compatibility>
<group-limit>
<group-includes>
<group-id name="123456"/>
</group-includes>
</group-limit>
<theme id="ktree_bootstrap" name="KTree Bootstrap">
<layout-templates>
<custom>
<layout-template id="one_row_bootstrap" name="One Row Bootstrap Layout">
<template-path>/layouttpl/custom/one-row-bootstrap- layouttpl/one_row_bootstrap.tpl</template-path>
<wap-template-path>/layouttpl/custom/one-row-bootstrap- layouttpl/one_row_bootstrap.tpl</wap-template-path>
<thumbnail-path>/layouttpl/custom/one-row-bootstrap- layouttpl/one_row_bootstrap.png</thumbnail-path>
</layout-template>
<layout-template id="one_two_3_9_column_bootstrap" name="1-2 (3/9span) Column Bootstrap Layout">
<template-path>/layouttpl/custom/one-two-3-9-column-bootstrap- layouttpl/one_two_3_9_column_bootstrap.tpl</template-path>
<wap-template-path>/layouttpl/custom/one-two-3-9-column-bootstrap- layouttpl/one_two_3_9_column_bootstrap.tpl</wap-template-path>
<thumbnail-path>/layouttpl/custom/one-two-3-9-column-bootstrap- layouttpl/one_two_3_9_column_bootstrap.png</thumbnail-path>
</layout-template>
</custom>
</layout-templates>
</theme>
</look-and-feel>

That’s it, now your theme would be visible to only specified group as mentioned in tag. Similarly we can configure to visible theme to particular roles with the given scope.

Looking for Liferay Developer?

KTree is the best offshore Liferay development company with extensive experience in Liferay Portal Development services along with Upgrade & Migration. Hire Liferay developers or Liferay development services from LiferayDeveloper.

Request For Quote