Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2024-08-05 14:49:39
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
txp:section_list and extra classes
Hello, is there a way to accomplish this type nav bar
<li class=“nav-item”><a class=“nav-link” href=”#”>Tour</a></li>
with <txp:section_list> as you see li and href tag has different classes , that is what I’m using, but I can’t find out how to use <a class
Thank you
Offline
Re: txp:section_list and extra classes
Either you create a form and use the attribute form="my-section-form"
, … or you can use the tag as a container:
<txp:section_list class="nav" wraptag="ul" break="li" breakclass="nav-item">
<a class="nav-link" href="<txp:site_url /><txp:section />"><txp:section title /></a>
</txp:section_list>
You might even be able to do: <txp:section link title class="nav-link" />
but I’m not sure, but the long-hard version above allows you to set a class for the active section:
<txp:variable name="current_section"><txp:section /></txp:variable>
<txp:section_list class="nav" wraptag="ul" break="li" breakclass="nav-item">
<a class="nav-link" href="<txp:site_url /><txp:section />"<txp:if_variable name="current_section" value='<txp:section />'> aria-current="page"</txp:if_variable>
<txp:section title />
</a>
</txp:section_list>
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1