WordPress.org

Support

Support » Themes and Templates » Change Page Tab order in header.php

Change Page Tab order in header.php

  • I’m using a theme called Celadon, which displays links to your Pages (minus any that you exclude in the theme’s custom menu) as tabs at the top of the page. By default these are sorted alphabetically, but I’d like them to be sorted by page order instead. I’ve set the page order for each page, but I need to adjust the header.php to show them in this order. This is the section of code which I think is responsible for the tabs:

    <div id="navigation">
    		<ul>
    			<li<?php if (is_home()) {
    									echo " class=\"active_tab\"";
    								} elseif (is_single()) {
    									echo " class=\"active_tab\"";
    								}
    								?>><a href="<?php echo get_bloginfo('url') ?>">Home</a></li>
    			<?php
    			  $pages = get_pages();
    				$celadon_excluded_pages = explode(", ", $celadon_excluded_pages);
    			  foreach ($pages as $pagg) {
    					$page_title = $pagg->post_title;
    					if (!in_array($page_title, $celadon_excluded_pages)) {
    					  $link = '<li';
    						if (is_page($page_title)) {
    							$link .= " class='active_tab'";
    						}
    						$link .= '>';
    						$link .= '<a href="'.get_page_link($pagg->ID).'">';
    						$link .= $page_title;
    						$link .= '</a></li>';
    						echo $link;
    					}
    			  }
    			?>
    		</ul>
    	</div>

    I don’t know much about PHP but have had a few stabs at it with no success. After reading the WordPress docs I was looking for ‘sortcolumn=’ where I could change the setting to ‘menu_order’, but this theme doesn’t seem to have that.

    How can I change the tabs to be arranged by Page Order?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Change Page Tab order in header.php’ is closed to new replies.
Skip to toolbar