• 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=\"https://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/about-acme/\" class=\"aboutcurrent\" title=\"About Acme\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('12')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"https://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/services/\" class=\"servicescurrent\" title=\"Services\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('1')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"https://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/news/\" class=\"newscurrent\" title=\"News\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('17')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"https://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/contact/\" class=\"contactcurrent\" title=\"Contact\"></a></li>
    		</ul>";
    			} elseif (is_page('home')) {
    				echo "<ul id=\"nav\">
    			<li><a href=\"https://s62925.gridserver.com/\" class=\"home\" title=\"Home\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/about-acme/\" class=\"about\" title=\"About Acme\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/services/\" class=\"services\" title=\"Services\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/news/\" class=\"news\" title=\"News\"></a></li>
    			<li><a href=\"https://s62925.gridserver.com/contact/\" class=\"contact\" title=\"Contact\"></a></li>
    		</ul>";
    			} else {
    			}?>
    		</ul>
Viewing 1 replies (of 1 total)
  • the posts page is referred to as if (is_home())

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

Viewing 1 replies (of 1 total)
  • The topic ‘Creating an image based navigation – need help with a function’ is closed to new replies.