WP List Pages, Please help me edit this code
-
Using a theme called ‘Dark Classic’ at: https://www.swisshut.com/manners.
I’m using the photobook module which displays all my galleries in the themes menu toolbar. I want to restrict this using wp_list pages. Have not had any luck!
Author made this change to the wp_list_pages:
function wp_list_pages2($limit=NULL) { $defaults = array('depth' => 1, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '5,6,7,8,9', 'title_li' =>'', 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title'); $r = array_merge((array)$defaults, (array)$r); $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 class="menu_sep">-</div><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; }
in the header file its then called like this:
<div id="menu_items"> <div><a href="<?php echo get_option('home'); ?>/">Home</a></div><?php wp_list_pages2(); ?> </div>
I’ve tried to add exclude tags, changing levels but never seems to show up perfect.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘WP List Pages, Please help me edit this code’ is closed to new replies.