Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Creating section navigation with active/populated sections only
Hey there,
I am pretty sure I have done this before, and found advice on this right over here before, but I can’t for the life of me remember how to, soo:
How can I tell a section navigation to show only those sections that are currently in use?
(Especially handy for multilingual sites w/ MLP, obviously)
Anyone??
Cheers,
-f
Last edited by funtoosh (2018-04-05 17:18:15)
Offline
Re: Creating section navigation with active/populated sections only
Hey, something like this (alter wraptag
as needed):
<txp:section_list wraptag="ul">
<txp:article_custom section='<txp:section />' limit="1" wraptag="li">
<txp:section link="1" title="1" />
</txp:article_custom>
</txp:section_list>
Offline
Re: Creating section navigation with active/populated sections only
Hi, you can try the untested code below:
<ul id="menu">
<li><a rel="home" href="<txp:site_url />"><txp:site_name /></a></li>
<txp:section_list break="li">
<txp:variable name="hasarticles" value='<txp:article_custom section='<txp:section />' break="" wraptag="" limit="1" />'>
<txp:if_variable name="hasarticles" value="">
<txp:else />
<txp:section title="1" link="1" />
</txp:if_variable>
</txp:section_list>
</ul>
>Edit: Oleg beat me to it with what looks like a more economical combination.
Last edited by colak (2018-04-05 17:55:51)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Offline
Re: Creating section navigation with active/populated sections only
Hey, thanx a lot! Simplicitity rules .-)
Offline