• Resolved nenjahinurgras

    (@nenjahinurgras)


    Hi everyone,

    Since I have spent the last four hours on finding a solution (in Codex and the forum) but could not find one, I decided posting this. I would like to remove all formatting (

    • and
      ) from the wp_list_categories output. Is that possible? I have already found the tag

      wp_list_categories('show_count=0&style=nonetitle_li=');

      which gives a list without

    • . The only disadvantage is that it still adds a
      after each category link. I have looked through category-template.php but couldn’t find anywhere the code where this
      is added. Does anyone know where I should look to remove this code? Any help appreciated!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter nenjahinurgras

    (@nenjahinurgras)

    Mmm, let’s repost that to display the code as well:

    Hi everyone,

    Since I have spent the last four hours on finding a solution (in Codex and the forum) but could not find one, I decided posting this. I would like to remove all formatting (<li></li> and <br />) from the wp_list_categories output. Is that possible? I have already found the tag

    wp_list_categories('show_count=0&style=nonetitle_li=');

    which gives a list without <li></li>. The only disadvantage is that it still adds a <br /> after each category link. I have looked through category-template.php but couldn’t find anywhere the code where this <br /> is added. Does anyone know where I should look to remove this code? Any help appreciated!

    You’ve got the tag wrong it should be
    wp_list_categories('show_count=0&style=none&title_li=');

    Thread Starter nenjahinurgras

    (@nenjahinurgras)

    Sorry, typo. That does not change anything to my question though..

    That’s how the tag should work. I’ll have to test myself to see it there is a bug or not. I’ll let you know what I find out.

    After reading back over the docs it seems that behavior is correct. All the style=none does is to not format the categories with a <li> tag but the br is still inserted.

    Thread Starter nenjahinurgras

    (@nenjahinurgras)

    Please read my initial post. I did not ask whether adding a br is correct behavior or not. Yes indeed it does add br because it was programmed to. I have no problem going through the php and changing the code myself. But someone please find the spot where the br is added, since I cannot find it anywhere…

    Thread Starter nenjahinurgras

    (@nenjahinurgras)

    For everyone just as desperate as me to change “correct behavior”, please find the code where the br is added in classes.php (under wp-includes) on line 639.

    And for the programmers of WP: First of all, let me emphasize that I love what you do, for free! That’s great, it really is. Just one tip for a next version, please make wp_list_categories, wp_list_bookmarks and wp_get_archives have similar arguments for styling, so it easy to change them all to the same layout.. Thanks everyone!

    Thanks for your follow up post with the location of that code! I was having a heck of a time trying to get a style on wp_list_categories to match a wp_get_archives with format=custom and your post saved the day.

    Thanks to nenjahinurgras for that tip. I too have been wracking my brain over how do find that function and modify it. Good job!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove ALL styling wp_list_categories’ is closed to new replies.