Forums

category pages / homepage link in top nav (12 posts)

  1. redrooster123
    Member
    Posted 2 years ago #

    Hi,

    I am using categories in my top navigation here

    http://west-ham-fans.com

    I need a home link to be the first link in that bar, but cannot find any solution to this. This is mainly due to the fact that they are indeed categories here, and not pages.

    All I can think to do is change my top navigation to be pages instead of links - problem solved. But then how will I assign categories to each individual page? (ie News page - display news categories, football results - displays football results categories)

    What is your guys advice to solve this? I tried 'page links to' which is great but add the link to the pages list on the RHS - not my top nav (as these are cat's)!!!

    Thanks for ahelp in advance :)

  2. Samuel B
    moderator
    Posted 2 years ago #

    what happens if you add
    <li><a href="<?php echo get_option('home'); ?>">Home</a></li>
    to your navbar code in header.php
    play with it

  3. Derek Herman
    Member
    Posted 2 years ago #

    better yet, this will work with your CSS

    <li<?php if (is_home()) { echo ' class="current-cat"'; ) ?>>
      <a class="fadeThis" href="<?php echo get_option('home'); ?>"
        <span>Home</span>
      </a>
    </li>
  4. redrooster123
    Member
    Posted 2 years ago #

    I tried that valendesigns, but im pretty sure im missing something basic when i paste the code in:

    <!-- header -->
    <div id="header-wrap">
    <div id="header" class="block-content">
    <!-- main navigation -->
    <div id="nav-wrap1">
    <div id="nav-wrap2">
    <ul id="nav">
    <?php

    <li<?php if (is_home()) { echo ' class="current-cat"'; ) ?>>
    "
    <span>Home</span>

    if((get_option('show_on_front')<>'page') && (get_option('arclite_topnav')<>'categories')) {
    if(is_home() && !is_paged()){ ?>
    <li id="nav-homelink" class="current_page_item">" title="<?php _e('You are Home','arclite'); ?>"><span><?php _e('Home','arclite'); ?></span>
    <?php } else { ?>
    <li id="nav-homelink">" title="<?php _e('Click for Home','arclite'); ?>"><span><?php _e('Home','arclite'); ?></span>
    <?php
    }
    } ?>
    <?php

    I have just shown a section of the code on the header.php here - where am I going wrong? (as you most prob can see, php is not my strong point)

  5. redrooster123
    Member
    Posted 2 years ago #

    <!-- header -->
      <div id="header-wrap">
       <div id="header" class="block-content">
          <!-- main navigation -->
         <div id="nav-wrap1">
          <div id="nav-wrap2">
            <ul id="nav">
             <?php
    
    <li<?php if (is_home()) { echo ' class="current-cat"'; ) ?>>
      <a class="fadeThis" href="<?php echo get_option('home'); ?>"
        <span>Home</span>
      </a>
    </li>
              if((get_option('show_on_front')<>'page') && (get_option('arclite_topnav')<>'categories')) {
               if(is_home() && !is_paged()){ ?>
                <li id="nav-homelink" class="current_page_item"><a class="fadeThis" href="<?php echo get_settings('home'); ?>" title="<?php _e('You are Home','arclite'); ?>"><span><?php _e('Home','arclite'); ?></span></a></li>
               <?php } else { ?>
                <li id="nav-homelink"><a class="fadeThis" href="<?php echo get_option('home'); ?>" title="<?php _e('Click for Home','arclite'); ?>"><span><?php _e('Home','arclite'); ?></span></a></li>
              <?php
               }
              } ?>
             <?php
  6. redrooster123
    Member
    Posted 2 years ago #

    sorry - re-posted again using the <correct> code method.

  7. Derek Herman
    Member
    Posted 2 years ago #

    the <?php was in the wrong place

    <!-- header -->
      <div id="header-wrap">
       <div id="header" class="block-content">
          <!-- main navigation -->
         <div id="nav-wrap1">
          <div id="nav-wrap2">
            <ul id="nav">
              <li<?php if (is_home()) { echo ' class="current-cat"'; ) ?>>
                <a href=<?php get_option('home'); ?>">
                  <span>Home</span>
                </a>
              <li>
    
         <?php if((get_option('show_on_front')<>'page') && (get_option('arclite_topnav')<>'categories')) {
               if(is_home() && !is_paged()){ ?>
                <li id="nav-homelink" class="current_page_item"><a>" title="<?php _e('You are Home','arclite'); ?>"><span><?php _e('Home','arclite'); ?></span></a>
               <?php } else { ?>
                <li id="nav-homelink"><a>" title="<?php _e('Click for Home','arclite'); ?>"><span><?php _e('Home','arclite'); ?></span></a>
              <?php
               }
              } ?>
             <?php
  8. Derek Herman
    Member
    Posted 2 years ago #

    Man the forum kept removing parts of the code, it's fixed now I think.

  9. redrooster123
    Member
    Posted 2 years ago #

    Im not sure it is - I just tried that in there - spitting back errors!

    Thanks for the effort tho

  10. redrooster123
    Member
    Posted 2 years ago #

    I tried both of these, no joy sadly.
    Dont suppose anyone else has a solution?

  11. Derek Herman
    Member
    Posted 2 years ago #

    thats because whatever is after the last <?php at the end is not shown and therefore if you don't have a closing ?> it will not work.

    Whats your error?

    you are adding this code above your other nav parts and before any php tags but directly after the nav ul?

    <li<?php if (is_home()) { echo ' class="current-cat"'; } ?>>
      <a href=<?php get_option('home'); ?>">
        <span>Home</span>
      </a>
    <li>
  12. digitalnature
    Member
    Posted 2 years ago #

    the code you posted above is correct, the one you wrote before wasn't - missing }
    that's probably why he gets errors

Topic Closed

This topic has been closed to new replies.

About this Topic