Forums

CSS Sprites and PHP using dynamic menu highlighting (3 posts)

  1. meganlee1984
    Member
    Posted 11 months ago #

    On this site:
    http://jumpthru.net/newsite/vision/

    I am using CSS sprites for my navigation with PHP else statements to show the active state for the current page. All of the pages are working properly except for the page that contains the loop / blog postings ( http://jumpthru.net/newsite/commentary/)

    Do I need to call the php differently for this page?

    The PHP :

    <?php
    if ( is_page('vision') ) { $current1 = 'visionside a'; }
    elseif  ( is_page('team') ) { $current2 = 'teamside a'; }
    elseif  ( is_page('commentary') ) { $current3 = 'blogside a'; }
    elseif  ( is_page('organizations') ) { $current4 = 'orgside a'; }
    ?>

    The CSS:

    #sidebarnav ul#sidenav li.<?php echo $current1; ?> {
    	background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/vision2.png)  0px -106px !important;
    }
    
    #sidebarnav ul#sidenav li.<?php echo $current2; ?> {
    	background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/team2.png)  0px -106px !important;
    }
    
    #sidebarnav ul#sidenav li.<?php echo $current3; ?> {
    	background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/content2.png)  0px -106px !important;
    }
    
    #sidebarnav ul#sidenav li.<?php echo $current4; ?> {
    	background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/org2.png)  0px -106px !important;
    }

    Any help would be greatly appreciated.

  2. alchymyth
    The Sweeper
    Posted 11 months ago #

    the page that contains the loop / blog postings

    this is normally checked with is_home()

    http://codex.wordpress.org/Function_Reference/is_home
    http://codex.wordpress.org/Conditional_Tags

  3. meganlee1984
    Member
    Posted 11 months ago #

    Thank you greatly! That did it.

Reply

You must log in to post.

About this Topic