• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • Welcome to the XenForo 2 demo. This is a work in progress and you may find some rough edges. See more about what to expect.

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