• Hi… I’m still battling on with my site revamp and still hitting snags πŸ™

    I’ve been trying to customize a theme to my liking, but I’m having problems with the way the theme lists pages in the header as links… The first problem is that it will list absolutely every page in my site (and yes I have read about possible <?php wp_list_pages('title_li=&depth=1&page_sort=asc&exclude=1')?> ways around this, but the other problem I have is that that theme I’m using has a seperate pagelists.php file that deals with the page navigation and ‘wp_list_pages’ doesn’t feature anywhere in it!!!

    I’ve even tried using a page plugin that gives the option to remove certain pages from the menu, but they still appear???

    Here’s the pagelist.php file, which I’m hoping isn’t too long!!!

    <li<?php if (is_home()) echo " class=\"active_page\""; ?>><a href="<?php bloginfo('url'); ?>"><span>Home</span></a></li>
    
    				<?php
    
    				$pages = CMSTheme_GetPages();
    
    				if ($pages) 
    
    				{
    
    					foreach ($pages as $page)
    
    					{
    
    						$page_id = $page->ID;
    
    						$page_title = $page->post_title;
    
    						$page_name = $page->post_name;
    
    						if ($page_name == "archives")
    
    						{
    
    							(is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' class="active_page"':$selected='';
    
    							echo "<li".$selected."><a href=\"".get_page_link($page_id)."\"><span>Archives</span></a></li>\n";
    
    						}
    
    						elseif($page_name == "about")
    
    						{
    
    							(is_page($page_id))?$selected = ' class="active_page"':$selected='';
    
    							echo "<li".$selected."><a href=\"".get_page_link($page_id)."\"><span>About</span></a></li>\n";
    
    						}
    
    						elseif ($page_name == "contact")
    
    						{
    
    							(is_page($page_id))?$selected = ' class="active_page"':$selected='';
    
    							echo "<li".$selected."><a href=\"".get_page_link($page_id)."\"><span>Contact</span></a></li>\n";
    
    						}
    
    						elseif ($page_name == "about_short") {/*ignore*/}
    
    						else 
    
    						{
    
    							(is_page($page_id))?$selected = ' class="active_page"':$selected='';
    
    							echo "<li".$selected."><a href=\"".get_page_link($page_id)."\"><span>$page_title</span></a></li>\n";
    
    						}
    
    					}
    
    				}
    
    				?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • It is too long… and I’d simply delete (throw out) that pagelist file and use the normal wp_list_pages template tag instead, with all its parameters.
    Why overcomplicate things when there are simple, effective solutions?

    Thread Starter steph-angel

    (@steph-angel)

    I have ditched it, as I have with a lot of this overly complicated theme and I’ve simply replaced the page list menu for a simple horizontal list menu… I am stubbornly trying to get my head around the joys of PHP & CSS coding, but sometimes it’s best to stick with what you know!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page List problems’ is closed to new replies.