• Can anyone help. I’m using Kubrick and would like a page navigation bar under the header image. Can any tell me how to add one? All the plugins I’ve downloaded don’t work.

Viewing 15 replies - 1 through 15 (of 22 total)
  • hard coding?

    try to edit header.php, and add the code for a page navigation:

    <div id="head_nav">
    <ul>
    			<?php wp_list_pages('title_li=' ); ?>
    </ul>
    </div>

    – so that the code at the end looks like:

    <div id="header" role="banner">
    	<div id="headerimg">
    
    	<?php $blog_title = get_bloginfo('name');
    $blog_title = str_replace('o','<span style="color: #ccc;">o</span>',$blog_title);
    
    ?>
    		<h1><a href="<?php echo get_option('home'); ?>/"><?php echo $blog_title; ?></a></h1>
    		<div class="description"><?php bloginfo('description'); ?></div>
    	</div>
    </div>
    
    <div id="head_nav">
    <ul>
    			<?php wp_list_pages('title_li=' ); ?>
    </ul>
    </div>
    
    <hr />

    to turn it into a horizontal nav, edit style.css and add these lines at the end:

    /* horizontal header nav */
    #head_nav {margin: 5px 20px; float:left; background-color: #eee; width:720px; }
    
    #head_nav h2 {display:none;}
    
    #head_nav ul {
      float: left;
      width: 100%;
      margin:0;
      padding-left: 0;
      list-style-type:none;
      }
    
    #head_nav ul li { display: inline;  }
    
    #head_nav ul li a {
      float: left;
      display:block;
      padding-top: 7px;
      padding-bottom: 5px;
      padding-left:10px;
      padding-right:10px;
      text-decoration: none;
      border-right: 1px solid #000033;
      background:#eee;
      color:#000066;
      font-size:120%;
      }
    
    #head_nav ul li.current_page_item a {
        background-color: #ddd; color: #000;
    }
    
    #head_nav ul li a:hover {
        background-color: #ccc ; text-decoration:none;
    }
    ul li .current-page-item a {  color:#ddd; }

    change the colors, etc. to your liking…
    be aware, that the default them will be replaced with an update of wordpress, it is a good idea to save your modified default theme under a new name ??

    Thread Starter mikedeakin

    (@mikedeakin)

    Absolutely perfect…Thank You so much. Works perfectly!

    Thread Starter mikedeakin

    (@mikedeakin)

    Just need to know how to add a “Home” button to the nav bar now!

    <a href="<?php bloginfo('url'); ?>">Home</a>

    something like this may be useful

    before this
    <?php wp_list_pages('title_li=' ); ?>

    Thread Starter mikedeakin

    (@mikedeakin)

    That does add a home button, but it’s not inline and in the same format as my other nav buttons.

    hmm…I haven’t really messed with this too much…

    my list pages command is wrapped in <li></li> as is my home command….

    <ul>
          <?php if (is_page()) { $highlight = "page_item"; } else {$highlight = "page_item current_page_item"; } ?>
          <li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?>">Home</a></li>
          <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
        </ul>

    is what I have in total…..so I’m not sure if you are able to tinker with any of this info

    Thread Starter mikedeakin

    (@mikedeakin)

    Ok, thanks, I’ve managed to get it into the nav bar in the same format which is great, but I’d like to know if I can re-order the buttons so that the “Home” button is first.

    yeah, just swap where it’s located.

    put the code for youor home link (the one like this):
    <a href="<?php bloginfo('url'); ?>">Home</a>

    above the one that lists your pages (looks like this):
    <?php wp_list_pages('title_li=' ); ?>

    Thread Starter mikedeakin

    (@mikedeakin)

    It doesn’t work there as it loses all its formatting.

    that is @pRVoodoo’s code for the home link in the right postion to show ‘home’ first in the nav; can’t see any reason why it wouldn’t work:

    <div id="head_nav">
    <ul>
    
    		<?php if (is_page()) { $highlight = "page_item"; } else {$highlight = "page_item current_page_item"; } ?>
          <li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?>">Home</a></li>
    
    		<?php wp_list_pages('title_li=' ); ?>
    </ul>
    </div>

    does your code look like this?

    Thread Starter mikedeakin

    (@mikedeakin)

    No, that didn’t work, which is why I had to put it after

    <?php wp_list_pages(‘title_li=’ ); ?>

    can you post your header.php in a pastebin ?

    do you use a sticky front page?

    or you could try this code (conditional format for front page)

    <ul>
    
    		<?php if (is_front_page()) { $highlight = "page_item  current_page_item"; } else {$highlight = "page_item"; } ?>
          <li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?>">Home</a></li>
    
    		<?php wp_list_pages('title_li=' ); ?>
    </ul>

    Thread Starter mikedeakin

    (@mikedeakin)

    Resolved the issue with a sticky front page, I must admit I never thought of that work around, I’d still like to order my page buttons with Home first though!

    not sure, this might help:
    in ‘edit page’, you can set a number for each page that helps to order them in the menu screenshot

    https://codex.www.ads-software.com/Template_Tags/wp_list_pages

    the code snippet would be:
    <?php wp_list_pages('title_li=&sort_column=menu_order' ); ?>

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Kubrick: Need a page navigation bar’ is closed to new replies.