Revision: 22497
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 13, 2010 12:10 by mdesilets
Initial Code
// Place this section in your functions.php <?php function removeParentLinks() { $pages = wp_list_pages('echo=0&title_li='); $pages = explode("</li>", $pages); $count = 0; foreach($pages as $page) { if(strstr($page,"<ul>")) { $page = explode('<ul>', $page); $page[0] = str_replace('</a>','',$page[0]); $page[0] = preg_replace('/\<a(.*)\>/','',$page[0]); if(count($page) == 3) { $page[1] = str_replace('</a>','',$page[1]); $page[1] = preg_replace('/\<a(.*)\>/','',$page[1]); } $page = implode('<ul>', $page); } $pages[$count] = $page; $count++; } $pages = implode('</li>',$pages); echo $pages; } ?> // Now just replace your wp_list_pages(); function with removeParentLinks(); //and away you go.
Initial URL
http://bavotasan.com/tutorials/how-to-remove-the-links-to-parent-pages-in-the-wordpress-page-list/
Initial Description
If you have your wordpress subpages organized by parent pages... and you dont want the parent pages "clickable" this will fix you right up...
Initial Title
Remove wordpress parent links
Initial Tags
wordpress, navigation, links
Initial Language
PHP