• Hey,
    I’ve put together a hack that allows for static pages and hidden categories (as the title hints).
    https://stevarino.com/2004/03/hidden-categories-in-wp/
    It’s a bit long. I figure 20 minutes for a WP veteran, and maybe up to an hour or two for someone new to this. Sorry, but it’s pretty complicated and thorough.
    Also I know the developers are going to hate me for this as it’s not exactly “minimally invasive” and I do alter some wordpress functions. Just remember it’s my first hack? ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • browsed the WordPress Support Forums, but found no solution.

    Either you didn’t search hard enough, or not for the right thing.
    Less intrusive, and just as effective and no hacking of the core, just a modified version of index.php.
    WP Static Pages Made Easy
    TG

    browsed the WordPress Support Forums, but found no solution.

    ?

    a simple change to the db would have done the job:
    1- for category creations, add a simple buttonor choice to have a: public/hidden/private category type, and that’s all… public cats would be seen by any, hidden to nobody, and private need a password… the hidden cat would be found by url but not by direct link in front page… so you can add your own link anywhere to access the posts in it.
    2- static pages are easy too… as the content of the site is in a template. duplicate the index, and name it anything.php … delete everything that is inside the <div id=”content”> tag… and put this: include_once ‘wp-pages/’.$_GET[‘page’];
    … after that, create a directory /wp-pages/ and put your static pages in it.
    so each time you call a anything.php?page=yourfile , the file itself will be integrated to the core of the page.

    Hey – glad to see my suggestion worked out for you.
    There are probably some simpler implementations, though yours is close to what I probably would have done first-out anyway. ??
    Some quick thoughts/comments:
    – #3 is a nice bonus for some users, but I don’t need it — in addition, many people (like me) can’t easily do rewrite rules on the server. thus, some of that approach for reaching static content doesn’t work. simply accessing by the category number is good, though I’m looking at adding access to categories by name (I’ll look to see if that’s already in WP hidden away somewhere…)
    – in effect, since you are just creating a ‘hidden’ category, it’s easy to detect (and tweak) within index.php. get the catname (not the nicename) of the current category. Start with a ‘.’? Good. If it does, you can either do your ‘split’ case ‘if’ statement, or more my style is to >add< an extra ‘div’ wrapper around the posts in the category, and let CSS rules take care of the styling.
    – of course, the cat-list-lookups still need the tweaks to not return hidden cats. but that’s simple mods, needed for the overall effect to work.
    In essence, ‘static content’ is no more than a restyling of what already exists. By adding a div around such content, you can easily tweak from there on. Of course, if you really want a completely different set of content, then the if-else approach definitely is better suited.
    I’ll go whip this up tonight, try it out.
    -d

    in hindsight, I might take nexia’s approach. that makes categories similar to posts in that they have ‘visibility’ classes. I like the public/hidden/private classification, and if I have to hit the database anyway, might as well let it filter them for me faster, AND I don’t have to mangle names at all by tacking on periods.
    yes, it means I’m changing schemas… but I do that EVERY DAY now.
    -d
    https://www.chait.net

    Stevarino – as for editing when an FTP client isn’t available (which begs how would you GET WP installed in the first place ;P ) I use the edit Template capability built right into WP, in fact I like it better since the edit box is much larger than the usual post edit box. Second, I may not want comments on the static content (although I do realize that I can turn off comments for any given post, so that arguement doesn’t hold water) Lastly, in my case, my “static” content is driven by function in WP, such as Latest Comment, Comment Leaders and Links. PHP doesn’t work too well within a post, it’ll get rendered instead of bein run. The biggest selling point for me on the way I did it was that I did not have to touch any of the base core files for WP. Just created a stripped down version of index.php, and use that as my template. All of the other suggestions I’ve seen have involved messing with the core files. What happens when you get the next release? Or am I missing something?
    I’m not trying to be argumentative, nor am I saying that the alternatives are wrong, my point is simply there is more than one way.
    TG

    this is my static.php page:
    https://gat.blogo.net/hacks/static.phps
    this is an example of my .htaccess file entry:
    https://gat.blogo.net/hacks/htaccess.txt
    static.php should be included into the main wp template with:

    <?php
    $static = $_GET['static'];
    if ($static == 1) { include('static.php'); }
    else { ?>
    [... wordpress loop here ...]
    <?php } ?>
    to fool wordpress and not to show your static page fake year (in my case, 2000), use the 'nicer archives' hack ( https://www.ads-software.com/support/10/2598 ) and replace this

    if ($year == $m) {
    $output .= ' selected="selected"';
    }
    $output .= '>'.$year.'</option>';

    with

    if ($year == $m) {
    $output .= ' selected="selected"';
    }
    if ($year == 2000) $year = statiche ;
    $output .= '>'.$year.'</option>';

    and
    if ($thisdate != $previous) {
    $thismonth = mysql2date('m', $post->post_date);
    $output .= '<br/><br/>'.$month[$thismonth].' '.$thisyear.'';
    }

    with

    if ($thisdate != $previous) {
    $thismonth = mysql2date('m', $post->post_date);
    if ($thisyear == 2000) { $output .= '<br/><br/>Static Pages</strong<';} else {
    $output .= '
    <br/><br/>'.$month[$thismonth].' '.$thisyear.'';
    } }

    this is the faked archive page (choose 'statiche' in the dropdown menu to see):
    https://gat.blogo.net/archivi/
    this is an example of what you can get:
    https://gat.blogo.net/static/trying-static-page-hack/

    ok, i know my code is broken, but i get an ‘antispam’ message each time i try to modify my post, even after 10 minutes ?? i give up..

    I know too little about PHP and coding to do the selective visibility option myself. But I really like the idea of having invisible/password protected categories. Actually I’d even more so I’d like categories visible per user level, e.g. users have to be level 5 or above to see such and such category and only admin, level 10 can see them all.
    Could somebody give me some more detailed steps to do for what nexia had pointed out when writing:

    a simple change to the db would have done the job:
    1- for category creations, add a simple buttonor choice to have a: public/hidden/private category type, and that’s all… public cats would be seen by any, hidden to nobody, and private need a password… the hidden cat would be found by url but not by direct link in front page… so you can add your own link anywhere to access the posts in it.

    thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Static Pages and Hidden Categories’ is closed to new replies.