• Resolved marisaharwood

    (@marisaharwood)


    Hi,

    I have created my navigation which works fine. I would like to apply an active state to the list item depending on what category you are on. I know how to do this in css and html, but I’m new to php and I’m struggling a bit.

    Please help :O)

    <ul id="nav">
    
                     <?php $category_id = get_cat_ID( 'pensions' ); $category_link = get_category_link( 3 );?>
    
                     <li id="nav-pensions"><a href="<?php echo $category_link; ?>" title="pensions"><span>pension</span></a></li>
    
                     <?php $category_id = get_cat_ID( 'money' ); $category_link = get_category_link( 4 );?>
    
                     <li id="nav-money"><a href="<?php echo $category_link; ?>" title="everyday money"><span>everyday money</span></a></li>
    
                     <?php $category_id = get_cat_ID( 'mortgages' ); $category_link = get_category_link( 5 );?>
    
                     <li id="nav-mortgages"><a href="<?php echo $category_link; ?>" title="mortgages"><span>mortgages</span></a></li>
    
                     <?php $category_id = get_cat_ID( 'savings' ); $category_link = get_category_link( 6 );?>
    
                     <li id="nav-savings"><a href="<?php echo $category_link; ?>" title="saving and investments"><span>savings and investments</span></a></li>
    
                     <?php $category_id = get_cat_ID( 'protection' ); $category_link = get_category_link( 7 );?>
    
                     <li id="nav-protections"><a href="<?php echo $category_link; ?>" title="protection"><span>protections</span></a></li>
    
                   </ul>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘active navigtion’ is closed to new replies.