• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • As we have now upgraded the main XenForo community, this forum is now being retired. It will remain open in a mostly read only state. Any further feedback, suggestions or bug reports should be posted on the main forum. We will still process the existing bug reports from this forum.

    When we approach a stable release, this forum will become inaccessible. If there is any content you wish to save, please do so before then.

Basic widget example

An example of a page node that contains widgets.

Widgets are flexible enough to be able to add them to any template, be that a normal template or to individual page nodes.

To add a widget to a sidebar on a page node, for example the Members Online Now widget, you can include the following code, anywhere in your page node template:

<xf:widget class="XF:MembersOnline" opt-limit="50" opt-staffOnline="1" title="Online Members" position="sidebar" />

As you can see, you can use any widget you like, and configure it directly in the template. Alternatively, if you already have a widget configured on another page such as the forum_list_new_posts widget from the forum list then you can just call that as follows and it will automatically use the same configuration:

<xf:widget key="forum_overview_new_posts" position="sidebar" />
  • Published
    Nov 18, 2016
  • Page views