need help with some regex (1 post)

  1. krembo99
    Posted 6 years ago #

    So, I need to DROP the class attribute from the wp_list_categories function, but NOT on the core files.

    right now the source code is :

    <!--Start krembo99 horiz navigation bar-->
    <ul id="menu" class="sf-menu">
    <li class="cat-item cat-item-6"><a href="http://www.xxxx.org/wp/?cat=6" title="blabla">Buzziiii</a></li>
    <li class="cat-item cat-item-7"><a href="http://www.xxxx.org/wp/?cat=7" title="blabla">Competitionsornot</a>
    <ul class='children'>
    <li class="cat-item cat-item-14"><a href="http://www.xxxx.org/wp/?cat=14" title="blabla">tesdrtf</a></li>
    <li class="cat-item cat-item-13"><a href="http://www.xxxxxx.org/wp/?cat=13" title="blabla">tesr566</a></li></ul></li>
    <li class="cat-item cat-item-8"><a href="http://www.xxxxxx.org/wp/?cat=8" title="blabla">Events</a>
    <li class="cat-item cat-item-11"><a href="http://www.xxxxxx.org/wp/?cat=11" title="Vblabla">Featured Articles</a>
    <li class="cat-item cat-item-1"><a href="http://www.xxxxxx.org/wp/?cat=1" title="blabla">Uncategorized</a>
    <!--End pages navigation-->

    I need to go from this :
    <li class="cat-item cat-item-8">
    to this :

    So I tried to regex :

    <ul id="menu" class="sf-menu"><?php
        $k99_neat_cats = wp_list_categories('orderby=name&amp;show_count=0&amp;title_li=');
        $k99_neat_cats = preg_replace('/\<li class\="(.*?)\"/','',$k99_neat_cats);
        echo $k99_neat_cats;

    no good. any help ???

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.