Is there a standard page-specific php variable that can be identified on each page. I would like to use this to format my navigation bar.
Many thanks.
Is there a standard page-specific php variable that can be identified on each page. I would like to use this to format my navigation bar.
Many thanks.
if(is_page())
Thanks, but what goes inside the brackets? What is the actual page-specific variable? Or is it a string?
That's what you can use to tell if its a page or not, for example
<?php
if(is_page()) {
//anything here is executed
}
Yes, but what I want to do is to know which page it is, so that I can format my navbar accordingly. For example "if (is_home())" identifies that it is the homepage, but I'm not sure how. I'm looking for something like "if (is_somepage())" - so what sets "somepage" for each of my pages?
Actually, it seems to work by using the page slug:
if (is_page('my-page-slug')) {
This topic has been closed to new replies.