1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 How can I create a hook for all forums of a single category?

Discussion in 'XenForo Questions and Support' started by rhodes, Aug 16, 2014.

  1. rhodes

    rhodes Active Member


    I use his code to show some widgets only in the sidebar of a single forum. In this example it is the forum with id=7.

    <xen:if is="{$forum.node_id} == 7">
    <xen:hook name=„myhook“... />

    My forum structure is like this

    Category 5
    forum 6
    forum 7
    forum 8

    Now I would like to create „myhook“ in all forums of category 5. Is it possible without repeating the code from above for every forum ID?

    regards, rhodes
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Try this:

    <xen:if is="{$forum.parent_node_id} == x">
    This content will show in forums of parent x
    rhodes likes this.
  3. rhodes

    rhodes Active Member

  4. rhodes

    rhodes Active Member

    May I ask one last question?

    When I try to create the hook for a category page like this

    <xen:if is="{$category.node_id} == 16">
    This content will show in sidebar of category id 16

    it won't work. Any ideas?
  5. Brogan

    Brogan XenForo Moderator Staff Member

    That will only work if you have categories set as pages in the ACP -> Options -> Node & Forum List: Create Pages for Categories.

Share This Page