WordPress.org

Ready to get started?Download WordPress

Forums

Adding ID to each UL when listing pages (3 posts)

  1. peterbra
    Member
    Posted 4 years ago #

    I have a page like this:
    Example:

    <div id="partners-menu">
    <ul>
    <li class="page_item page-item-1"><a href="#" title="Title">Title</a></li>
    <li class="page_item page-item-2"><a href="#" title="Title">Title</a></li>
    <li class="page_item page-item-3"><a href="#" title="Title">Title</a>
    <ul>
    	<li class="page_item page-item-4"><a href="#" title="Title">Title</a>
    	   <ul>
    		   <li class="page_item page-item-5"><a href="#" title="Title">Title</a></li>
    		   <li class="page_item page-item-6"><a href="#" title="Title">Title</a></li>
    	   </ul>
    </li>
    </ul>
    </ul>
    </div>

    What I want to do is to add random ID (preferably incrementing ID) to each of

      so I can get something like:
      <ul id="list1">
        <li>...
          <ul id="list2">
             <li>...</li>
          </ul>
          <ul id="list3">
             <li>...</li>
          </ul>
      </li>
      </ul>

      Can i do it with wp_list_pages finction and how ?

      Thanks for helping me !!

  2. s_ha_dum
    Member
    Posted 4 years ago #

    I don't see any way to do that with wp_list_pages. I think you are going to have to roll you own function. You can find the wp_list_pages function here (line 738) and use that as a template.

  3. peterbra
    Member
    Posted 4 years ago #

    Thanks for the tip. I'll look into it now.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.