• Hey wordpress noob here. I’ve been asked to develop a website in wordpress as a cms. The first problem I see is that there is a list of pages in a sidebar which includes a number and ‘stage x’, see the html below:

    <aside class="sub-nav three columns">
          <h2>Stages:</h2>
          <ol class="stages-sub-nav">
            <li><a href="#" class="active"><span class="stage-num">1</span><span class="sub-stage">Stage 1</span>SubNav List Item</a></li>
            <li><a href="#"><span class="stage-num">2</span><span class="sub-stage">Stage 2</span>SubNav List Item</a></li>
            <li><a href="#"><span class="stage-num">3</span><span class="sub-stage">Stage 3</span>SubNav List Item</a></li>
            <li><a href="#"><span class="stage-num">4</span><span class="sub-stage">Stage 4</span>SubNav List Item</a></li>
            <li><a href="#"><span class="stage-num">5</span><span class="sub-stage">Stage 5</span>SubNav List Item</a></li>
            <li><a href="#"><span class="stage-num">6</span>SubNav List Item</a></li>
            <li><a href="#"><span class="stage-num">7</span>SubNav List Item</a></li>
          </ol>
        </aside>

    I’ve read about wp_list_pages and to hard code it I imagine i’d write:

    wp_list_pages('link_before='<span class="stage-num">5</span><span class="sub-stage">Stage 5</span>');

    My question is how would I dynamically increment the numbers in both spans within the list for each page listing. (There are currently 6 stages). Also some pages have no stage number so I wouldn’t want to print out the second span for these.

    Just to add, in my page header I have the following code, which you can see also has a span with the stage number:

    <div class="feature-content seven columns mobile-three">
              <span class="top-stage">Stage 1</span>
              <h1>Market Research</h1>
              <p>Before developing a new course, it is important to define your main objectives & your primary audience(s). This will help to inform your decisions on format and content as well as price of the course.</p>
            </div>

    Hope someone can help!

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding extra information to a list of pages’ is closed to new replies.