XF 2.1 How to set specific widgets for specific Page nodes?

Ludachris

Well-known member
Let's say you have a few page nodes created and you want to set specific widgets to display in those nodes, how would you do that? The only way I can see to get widgets to display on page nodes is to set the widget to display on ALL nodes, which I don't want to do. I want them the widget to display in all the locations I specified AND on a few page nodes too.
 
Couple ways of doing it I suppose.

Create a new widget, set location to public sidebar: bottom/top, set the display conditional to:

Code:
$xf.reply.containerKey == 'node-10'

10 is the page ID. The downside to this method is ordering the widgets is limited.


Another way when editing the page node contents (Template HTML), just manually add the widgets using this method:

Code:
<xf:widget key="testwidgettest" position="sidebar" />
<xf:widget key="forum_overview_members_online" position="sidebar" />
<xf:widget key="forum_overview_share_page" position="sidebar" />
 
Couple ways of doing it I suppose.

Create a new widget, set location to public sidebar: bottom/top, set the display conditional to:

Code:
$xf.reply.containerKey == 'node-10'

10 is the page ID. The downside to this method is ordering the widgets is limited.


Another way when editing the page node contents (Template HTML), just manually add the widgets using this method:

Code:
<xf:widget key="testwidgettest" position="sidebar" />
<xf:widget key="forum_overview_members_online" position="sidebar" />
<xf:widget key="forum_overview_share_page" position="sidebar" />
Awesome, thanks Russ, that's what I needed.
 
Back
Top Bottom