I have a template that is used for many different sections of my site (About, News, etc.). The nav bar needs to show a little graphic arrow below the section you're in. I was passing this via the template:
$page = 'about'; require('header.php');
...but then I realized that won't work since the template file I was editing is used for a bunch of different sections, not just 'about'.
So I need something on the
'page' interface screen where I can somehow indicate the page that the user is on. Some ideas for solutions:
- Idea #1: does WordPress would set some kind of class on the 'body' tag to indicate the page you're on (like if it generated a slug based on the page name and added that as a class to the body tag)? Then just do everything I need to do in CSS without complicating things.
- Idea #2: some kind of built-in field on WordPress's 'page' admin that would let my header know what page it is on.
- Idea #3: I could make copies of my template for each major section. Very stupid way to go about it.
I would REALLY prefer to not go the whole extra-fields route, manually adding a metadata field to my pages, pulling it from the db on page load, etc. That seems like super overkill for just having a way to let my template code identify what page it is being used on.