Support » Plugins » need help with some regex

  • 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="" title="blabla">Buzziiii</a></li>
    <li class="cat-item cat-item-7"><a href="" title="blabla">Competitionsornot</a>
    <ul class='children'>
    <li class="cat-item cat-item-14"><a href="" title="blabla">tesdrtf</a></li>
    <li class="cat-item cat-item-13"><a href="" title="blabla">tesr566</a></li></ul></li>
    <li class="cat-item cat-item-8"><a href="" title="blabla">Events</a>
    <li class="cat-item cat-item-11"><a href="" title="Vblabla">Featured Articles</a>
    <li class="cat-item cat-item-1"><a href="" 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 ???

  • The topic ‘need help with some regex’ is closed to new replies.