Support » Requests and Feedback » <?php wp_list_pages(); ?> create to mutch code!!!

  • The code <?php wp_list_pages(....); ?> in the navlist.php file create huge code:

    <li id="pagenav">
    <li class="page_item"><a href="link">Page 1</a></li>
    <li class="page_item"><a href="link">Page 2</a></li>

    I dont need the tags
    I will create a navigation with static and direkli links, iclude the “wp_list_pages” – all in one!! list (
    <li>)<br />



Viewing 7 replies - 1 through 7 (of 7 total)
  • Mark (podz)


    Support Maven

    Remove that code, and instead hardcode the links instead.

    WordPress strives to be a semantic product, and a list of links is a list, ergo it is built using <ul> and <li> elements. It’s up to you whether or not you want to use them.

    In which file I have to delete the list HTML elements?
    (ul and li elements are good, but for a normal navigation the php query wp_list_pages() create to mutch list elements.)

    HTML Generation by PHP is not good.
    Can we fix that problem in a next release?


    Mark (podz)


    Support Maven

    I like the xhtml generation – if I am writing a list (and no matter which way you spin it, a list of pages is a LIST) – then I’d rather WP handle that markup. To ask for it to be fixed implies it is broken – it is not.

    I have given you the answer – hardcode the links.

    I think the problem is that quite some functions in WordPress generates a list with html tags without providing the option to substitute other elements instead of ul and li.

    WordPress strives to be a semantic product, so it is more important not to tie with a particular syntax. Providing a default is fine, however making it the only option…

    While re-designing my blog I found several such functions, which even though useful was clearly unsuitable for my purposes. So I was forced to redesign most of the template tags for my needs.

    For example I use two “The Loop”. However I realized it is wasteful to run the full loop when I can provide an optimized query to just fetch what I need.

    Same with category template tags, too much ul, li based and some of them makes assumptions about being within “The Loop”.

    A small solution :

      <?php wp_list_pages(‘title_li=’); ?>

    found on:

    I think the next version of WordPress should have an interface to allow the easy modification of all the WP operators, such as wp_list_pages. Allow people to change the before after and inbetween stuff.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘<?php wp_list_pages(); ?> create to mutch code!!!’ is closed to new replies.