Static
Inspired by the idea presented at Digitus, Finger & Co. I installed MooKitty’s Show Categories plugin and modified it with the code in a comment by Paul.
“Static pages” are posts but hidden from the index page, archives, and category listing. They can be found by search, however. I “staticised” my booklog and the page about me already but I still have some more work to do. I decided to keep commenting on for the static pages. I removed “lots” of things, though. It’s easy: Just add
<?php if ($cat != x) { ?> HIDDEN STUFF HERE <?php } ?>
around the bits you want to hide (x being the ID number of the category you are hiding). That bit of code means “if the category number does NOT equal x, show the bit between { and }”.
I hid the date, time posted, and word count.
The breadcrumb code is located outside the WP loop so at first I didn’t know how to get the category info for if-clauses (for hiding the breadcrumb from static pages). I found a function in_category(x) where x is the number of the category. It returns true or false. So, I put a
<?php if ( !in_category(x) ) { ?> HIDDEN STUFF HERE <?php } ?>
around the breadcrumb code and now it’s gone from the static pages just as I like it.
Making static (or more like non-entry) pages this way makes it easier for them to keep up with the modifications I make to the index page. I used to have the static pages as php pages where I had copied the “header” and “footer” of each page.
Leave a Reply