Hi I can’t seem to find a solution to my problem and I’ve been searching the internet for hours, so I was wondering if anyone in the WP forum can help?
I’m using this code to display my pages
<?php $args = array( 'sort_column' => 'menu_order', 'title_li' => '', 'depth' => '1', 'echo' => 0 ); $separator = '<img src="http://localhost/test_theme/images/nav-divide.png"'; $pattern = '/(<\\/a>).*?(<\\/li>).*?(<li)/is'; $replace = '</a>' . $separator . '</li><li'; $subnav = preg_replace($pattern,$replace,wp_list_pages($args)); echo $subnav; ?>
This work well, however I have the problem that I want to exclude the holding page from the list.
I usually use this code to remove a page
<?php $page1 = get_page_by_title ('Holding'); wp_list_pages('exclude='. $page1->ID . '&title_li='); ?>
but can’t use this because it doesn’t include the seperators, does anyone know how I can alter the code with the seperators to exclude the page with the title ‘Holding’?
I have looked at the ‘exclude’ => ”, but would like to exclude by title rather than by number.
Thanks in advance
- The topic ‘wp_list_pages excluding a page by title’ is closed to new replies.