Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Today 07:54:36

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,412
Website GitHub Mastodon Twitter

accordion yearly menu

I’m trying to create an accordion yearly menu but I cannot think of an economical way of constructing it. At the moment I have the following which is really bad as it needs to go back to 2006. Can anyone recommend a more efficient/automated way of doing it?

<div class="accordion">
  <div class="accordion-item" id="year_2026">
    <a href="#year2026" class="accordion-header">2026</a>
    <div class="accordion-content">
        <txp:article_custom month="2026" limit="999" section="projects" break="li" wraptag="ul">
            <a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
    </txp:article_custom>
    </div>
  </div>

  <div class="accordion-item" id="year_2025">
    <a href="#year2025" class="accordion-header">2025</a>
    <div class="accordion-content">
      <txp:article_custom month="2025" limit="999" section="projects" break="li" wraptag="ul">
            <a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
      </txp:article_custom>
    </div>
  </div>

  <div class="accordion-item" id="year_2024">
    <a href="#year2024" class="accordion-header">2024</a>
    <div class="accordion-content">
      <txp:article_custom month="2024" limit="999" section="projects" break="li" wraptag="ul">
            <a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
      </txp:article_custom>
    </div>
  </div>
</div>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 Today 09:03:31

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 17
GitHub GitLab Mastodon

Re: accordion yearly menu

I did something like this in my plugin abu_archtree, but it currently needs jQuery. I’m thinking about switching to using <details> and <summary> constructs.

For a live demo, you might take a look at my site.

Offline

Board footer

Powered by FluxBB