Forums

Creating an image based navigation - need help with a function (2 posts)

  1. gillsans
    Member
    Posted 3 years ago #

    Hello, I'm trying to determine the best to to make an image (navigation) 'currentstate' based on the category. It seems to fail when I try to add is_page('news'). News being my Posts page. I also tried to call News by its page id which didn't work either.

    What is the page id for the Posts page?
    What category or id do I use for posts?

    Sorry about the indenting.

    <!-- determines background image -->
    			<?php if (is_page('9')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"http://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/about-acme/\" class=\"aboutcurrent\" title=\"About Acme\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('12')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"http://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/services/\" class=\"servicescurrent\" title=\"Services\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('1')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"http://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/news/\" class=\"newscurrent\" title=\"News\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('17')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"http://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/contact/\" class=\"contactcurrent\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('home')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"http://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"http://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} else {
    			}?>
    		</ul>
  2. stvwlf
    Member
    Posted 3 years ago #

    the posts page is referred to as if (is_home())

    the front page when one is defined as if (is_front_page())

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.