Forum Replies Created

Viewing 1 replies (of 1 total)
  • <?php
                        $menu =  explode('<li ',substr((wp_list_pages("sort_order=asc&echo=0&depth=0&title_li=")),4));
                        $color = array('blue','orange','green');
                        $sub = 0;
                        $i = 0;
                        $id = array();
                        foreach ($menu as $key => $val) {
                            $match = $matches = 0;
                            if ($sub == 0){
                                $id[] = $key;
                                $pos = strpos($val,'<a');
                                $text = '<li><div class="'.$color[$i].'-left"></div><div class="'.$color[$i].'-mid">'.substr($val,$pos);
                                $text1 = str_replace('</a>','</a></div><div class="'.$color[$i].'-right"></div><div class="clear"></div>',$text);
                                $text2 = str_replace('<a','<a class="top" ',$text1);
                                echo $text2;
                            }else{
                                echo '<li '.$val;
                            }
                            if (preg_match_all("/(<ul>)/",$val,$match,PREG_PATTERN_ORDER)){
                                $sub = $sub + count($match[0]);
                            }else if (preg_match_all("/(<\/ul>)/",$val,$matches,PREG_PATTERN_ORDER)){
                                $sub = $sub - count($matches[0]);
                            };
                            $i++;
                            if($i==3){$i=0;};
                        }
                    ?>

    I use this code to modify only the first parent of list.
    you can make another methods too.
    I hope its solve your problem.

Viewing 1 replies (of 1 total)