‘Include=’ not working with modified wp_list_pages
-
Hi,
I’m working with a theme I did not design, and trying to use the include function in a modified wp_list-pages call. It’s not working. Three pages should be listed, only one is. The problem is with holidayfu.com
I declare
<?php wp_list_pages2('include=2,190,303'); ?>
but only page 2 is displayed, so 190 and 303 are not.
wp_list_pages2 is a theme function. The function is defined thus:
function wp_list_pages2($limit=NULL) { $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '', 'title_li' =>'', 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title'); $r = array_merge((array)$defaults, (array)$r);//make sure using the type conversion when you're using php5 $output = ''; $current_page = 0; // sanitize, mostly to keep spaces out $r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']); // Allow plugins to filter an array of excluded pages $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude']))); // Query pages. $pages = get_pages($r); if ( !empty($pages) ) { for($i=0;$i<count($pages);$i++) { $output .='<div><a href="'.get_page_link($pages[$i]->ID).'">'.$pages[$i]->post_title.'</a></div>'; if($limit!=NULL) { break; } } } $output = apply_filters('wp_list_pages', $output); echo $output; }
Any help would be greatly appreciated.
Thanks,
Iain
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘‘Include=’ not working with modified wp_list_pages’ is closed to new replies.