10/29/2014

Showing Web Contents in a Liferay Theme

If you want to render a WebContent as part of your theme, you can do the following. Create your theme as always, and put the following inside your init_custom.vm file:


#set ($journalArticleLocalService =$serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))

#set ($journalContentUtil =$utiLocator.findUtil("com.liferay.portlet.journalcontent.util.JournalContentUtil"))

#set ($web-content-display-article-id = "your-article-id-here")

#set ($web-content-display-article =$journalContentUtil.getContent($group_id, $web-content-display-article-id,null,"$locale",$theme_display))


If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.