• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Categories Widget | Show all Sub-Categories too?

Scheduled Pinned Locked Moved NodeBB Plugins
6 Posts 3 Posters 1.5k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xanthos84
    wrote on last edited by
    #1

    Hi,

    if I add the categories widget to a sidebar it only shows the Main/Head Categories
    but not the subcategories underneath it.

    Is it possible to show them too?

    Thanks!

    1 Reply Last reply
    0
  • X Offline
    X Offline
    xanthos84
    wrote on last edited by xanthos84
    #2

    after fiddeling around the complete day, i have found it!
    if anyone else need it, you can change the categories.tpl in /nodebb-widget-essentials/public/templates/widgets/ for example into:

    # code block
    <!-- BEGIN categories -->
    <ul class="categories-list">
    <li>
    <!-- IF !categories.link -->
    <h4><a href="{relative_path}/category/{categories.slug}">{categories.name}</a></h4>
    <!-- ELSE -->
    <h4><a href="{categories.link}">{categories.name}</a></h4>
    <!-- ENDIF !categories.link -->
    <!-- BEGIN children -->
    <!-- IF categories.children.link -->
    <a href="{categories.children.link}" itemprop="url" target="_blank">
    <!-- ELSE -->
      <a href="{config.relative_path}/category/{categories.children.slug}" itemprop="url">
    categories.children.name}</a><br /> 
      </div>
    <!-- ENDIF categories.children.link -->
    <!-- END children -->
    </li>
    </ul>
    <!-- END categories -->
    
    
    R 1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #3

    This is nice we should add this to widget-essentials.

    1 Reply Last reply
    0
  • R Offline
    R Offline
    rohimokat
    replied to xanthos84 on last edited by
    #4

    @xanthos84 said in Categories Widget | Show all Sub-Categories too?:

    code block

    <!-- BEGIN categories -->
    <ul class="categories-list">
    <li>
    <!-- IF !categories.link -->
    <h4><a href="{relative_path}/category/{categories.slug}">{categories.name}</a></h4>
    <!-- ELSE -->
    <h4><a href="{categories.link}">{categories.name}</a></h4>
    <!-- ENDIF !categories.link -->
    <!-- BEGIN children -->
    <!-- IF categories.children.link -->
    <a href="{categories.children.link}" itemprop="url" target="_blank">
    <!-- ELSE -->
    <a href="{config.relative_path}/category/{categories.children.slug}" itemprop="url">
    categories.children.name}</a><br />
    </div>
    <!-- ENDIF categories.children.link -->
    <!-- END children -->
    </li>
    </ul>
    <!-- END categories -->

    @xanthos84/ @baris : I tried this but it does not work. is there any other way?

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #5

    This should work with latest widget essentials (4.1.1).

    <!-- BEGIN categories -->
    <ul class="categories-list">
    <li>
    <!-- IF !categories.link -->
    <h4><a href="{relative_path}/category/{categories.slug}">{categories.name}</a></h4>
    <!-- ELSE -->
    <h4><a href="{categories.link}">{categories.name}</a></h4>
    <!-- ENDIF !categories.link -->
    <!-- BEGIN categories.children -->
    <p>
    <!-- IF categories.children.link -->
    <a href="{categories.children.link}" itemprop="url" target="_blank">
    <!-- ELSE -->
      <a href="{config.relative_path}/category/{categories.children.slug}" itemprop="url">
    {categories.children.name}</a><br /> 
      </div>
    <!-- ENDIF categories.children.link -->
    </p>
    <!-- END categories.children -->
    </li>
    </ul>
    <!-- END categories -->
    
    R 1 Reply Last reply
    0
  • R Offline
    R Offline
    rohimokat
    replied to <baris> on last edited by
    #6

    Thanks a lot @baris. It worked like a charm. Saw your commit on widget-essentials. Got to learn a lot.

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development