Hi I have a sidebar in Wordpress with the following <h3>Links</h3> <?php $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0'); $pages = preg_replace('%<a ([^>]+)>%U','<a $1>', $pages); $pages = str_replace('</a>','</a>', $pages); echo $pages; ?> PHP: The problem is that this produces HTML like <div class="about-all"><div class="about"><div class="about-body"> <h3>Links</h3> <li class="page_item page-item-2"><a href="http://blah.com" title="About">About</a></li> <li class="page_item page-item-372"><a href="http://blah.com" >Audio Class </a></li> <li class="page_item page-item-309"><a href="blah.com" >Video Classes 1</a></li> <li class="page_item page-item-355"><a href="blah.com" >Video Classes 2</a></li> </div> PHP: I do not want bullets.. I just want <br> separators. Any idea how to do this?
Should be someting more like this: $pages = preg_replace("/<(\/)?li(.*)>/U","", $pages); You had bad syntax and the above would be greedy and go all the way until the last > mark. In order to add the line breaks... change the full code to: <h3>Links</h3> <?php $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0'); $pages = preg_replace('%<a ([^>]+)>%U','<a $1>', $pages); $pages = str_replace('</a>','</a><br />', $pages); $pages = preg_replace("/<(\/)?li(.*)>/U","", $pages); echo $pages; ?> PHP: May I ask what the point of $pages = str_replace('</a>','</a>', $pages); was in your code? I changed it to add the line break.