Static pages…. faked….
-
There have been several requests to have “static” pages that could be linked to from the main index page. I’ve found a way to do it that was fairly painless. I’m sharing the experience in case it helps anyone else, or if some one wants to take the idea and expand on it.
In rearraging my site, I found my self with the need to create static pages…. well, they aren’t 100% static, but I wanted to display content that was not part of the blog. At least they weren’t part of the blog postings. My links got out of control, and so I removed them from the menu, but I still wanted to have them listed somewhere… So…. I took index.php and started to gut it…. I took everything out from between the <div id=”content”> </div> tags, then removed the foreach that appears between the opening rap div tag and the opening content div tag. I then saved it. That became my template. I then stuck in the PHP code to list links within the content tag. Saved it as links.php, and added it to the menu on index.php. And it worked.
That’s when I noticed a “problem.” The link was on the index page, but not on the subsequant links page. OK, I’ll admit, I’m a lazy bastard. I knew I had more of these kinds of pages to add…. I only want to do this once. So… I cut the entire menu div tag section out, and put it in its own file: menu.php. Then I edited each of my pages, removing the menu div section, replacing it with a include pointing to the menu.php file. Now, when I make a change (once) to the menu, it gets updated through out the entire site.
I thought about doin the same to the header portion, but that doesn’t change, and now that I have a template shell, is easily created when adding pages. The end result are three new pages that will be as dynamic as the main page, and yet has the option of being totaly static. And since the static pages fall within the WP templating, the CSS style switcher will work on all those pages as well!
If anyone wants further info, or a copy of the shell I created, just let me know.
TG
- The topic ‘Static pages…. faked….’ is closed to new replies.