Forums

How to add ids to page list items (1 post)

  1. altrugon
    Member
    Posted 3 years ago #

    Hi there,

    I need to modify the result of wp_list_pages() function so I can have ids inside the returned

  2. .

    I know I can go to the file classes.php and add the id manually inside the function start_el() but this is not a good technique because I have to modify the core code.

    I'm using gengo plugin and here is my code:
    PHP

    <ul id="menu-pages">
        <?php wp_list_pages('sort_column=menu_order&title_li=' ); ?>
      </ul>

    HTML

    <ul id="menu-pages" class="ui-sortable" style="position: relative;">
      <li class="page_item page-item-4 current_page_item"><a title="Home" href="http://.../home/en/">Home</a></li>
    ...
    </ul>

    And this is what I need:
    HTML

    <ul id="menu-pages" class="ui-sortable" style="position: relative;">
      <li id="page-home" class="page_item page-item-4 current_page_item"><a title="Home" href="http://.../home/en/">Home</a></li>
    ...
    </ul>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags