WordPress.org

Support

Support » Themes and Templates » help to add a | at the end of top navigation

help to add a | at the end of top navigation

  • Hi all,

    I’ve got a top nav that is being auto-populated by the pages in the site, exact code:

    function topnav() {
    	$disconnected_is_front = get_option('page_on_front');
    	$disconnected_frontpage = get_option('show_on_front');
    	$disconnected_page_for_posts = get_option('page_for_posts');
    	$disconnected_blog_page = get_post($disconnected_page_for_posts, Array_A);
    	$disconnected_blog_url = $disconnected_blog_page->guid; ?>
    
    	<ul id="topnav">
    
    	<li><a href="<?php if ( is_page() ) { bloginfo('home'); } else if ( $disconnected_frontpage == 'page' ) { echo $disconnected_blog_url; } else { bloginfo('home'); } ?>" id="navHome" title="Posted Recently" accesskey="h"><?php _e('Home', 'disconnected') ?></a></li>
    	<?php if ( $disconnected_frontpage == 'page' ) {
    		wp_list_pages('title_li=&sort_column=menu_order&depth=1&exclude='. $disconnected_is_front);
    	} else {
    		wp_list_pages('title_li=&sort_column=menu_order&depth=1');
    	}
    	wp_register('<li>','</li>'); ?>
    	<li><?php wp_loginout(); ?></li>
    	</ul>
    <?php }

    As you can see, I am using the “disconnected” theme designed by Sunburntkamel and very poorly hacked around by me. 🙂

    The theme creates a top nav that looks like:

    | link | link | link | link | link | logout

    I’d really like to place a | behind the final item in the top nav… but just can’t work out how to do it.

    Any ideas?

    Cheers and beers!

Viewing 1 replies (of 1 total)
  • EMG

    @emg

    Forum Volunteer

    Well, let’s see…

    I’m not much of a PHP person, so my notions are XHTML and CSS-related.

    You can manually (I know, that’s a bit of a pain and goes against the automation ability of the function) add in the FIRST/or LAST | and then specify that each link be FOLLOWED (before or after) with a | which would produce your desired results.

    Orrr… you could complicate things by telling each nav link to look like | link | and then use CSS to scoot the links over so that the adjoining || overlap.

    Instead of: | link | | link |, you would theoretically get this: | link | link |

    … I’m not sure how much sense that made. If I confused you, I’m sorry!

    Can you post a link to your site so we can peek at how the listing is being styled?

    How you can accomplish what you want to do depends on if you’re using the | character or CSS styling or a combination of both.

Viewing 1 replies (of 1 total)
  • The topic ‘help to add a | at the end of top navigation’ is closed to new replies.