Forums

WP List Pages, Please help me edit this code (7 posts)

  1. OzButcher
    Member
    Posted 4 years ago #

    Using a theme called 'Dark Classic' at: http://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.

  2. OzButcher
    Member
    Posted 4 years ago #

    I find I can get it pretty close using the standard WP_list_pages call but for some reason I get some random bullets showing up and messing up the menu options.

    In the code it says something about "Allow plugins to filter an array of excluded pages" I'm hoping this may help?

  3. OzButcher
    Member
    Posted 4 years ago #

    I am using this code

    '<div id="menu">
    <div id="menu_items">
    <div>/">Home</div><?php wp_list_pages('title_li=<h1>' . '</h1>&sort_column=ID&depth=1'); ?>
    </div>'

    Now it only shows one bullet! How can I get rid of this please? :(

    Screenshot:
    http://share.webcommand.org/Share/images/445672wp.jpg

  4. jeffr0
    Member
    Posted 4 years ago #

    Have you checked out the codex article related to this function?

  5. OzButcher
    Member
    Posted 4 years ago #

    Yes I have gone through it about 30 times and tried many different variations but just can not get that damn little bullet to go away! :(

  6. GuruXL
    Member
    Posted 4 years ago #

    Did you try CSS styling using the html>ul li selector?

  7. ektz
    Member
    Posted 4 years ago #

    yeah you should particularly style the ul li tag's css for menu. if you could send me the code for showing the page navi, i would be able to help u better.

Topic Closed

This topic has been closed to new replies.

About this Topic