• XEN DEVELOPMENT is a developer's resource for new developers wanting to build XenForo 2 add-ons. Experienced developers are also welcome to share their experienes and knowledge. This site is not affiliated with XenForo or a replacement for the official XenForo developer forums.

Beginners How to Render a Widget Externally


Flight Director
Staff member
Lifetime License
LPH submitted a new resource:

How to Render a Widget Externally - It only takes one line to pull a widget

Displaying a widget included with XenForo 2 is one line using templater() and renderWidget.

echo \XF::app()->templater()->renderWidget('forum_overview_members_online');
The identifier is the Widget key found in the admin panel -> Appearances -> Widget. The 'forum_verview_members_online' is the widget key for the Members Online.

This is the result.

View attachment 52

Careful, though. The links are all relative.
Read more about this resource...
The second parameter is an array of options. What are they?