• I saw a WP site awhile back that had separate pages for each of the major categories, with a static explanation of the category at the top. Does someone know the site I’m talking about? What are the steps to achieving such a thing?

Viewing 3 replies - 1 through 3 (of 3 total)
  • i don’t know what others have done, but i’ve been thinking of a way to do this — basically a way to let me use categories instead of multiple blogs. here’s a work-around i came up with. probably needs some more work, but:
    The file wp-blog-header.php pulls entries from the database using the category set in the query string (or all posts if no category is set), ie, index.php?cat=3 . You can hard code the category in this file to force the index page to show only one category, regardless of the query string. The category variable is $cat in this script. BUT, many pages use this script, including edit.php in the admin section. So, you need to set this variable inside an if statement so that it only changes it on the index page, not on other pages.
    Around line 54 in wp-blog-header.php there’s a for loop containing the variables $wpvar and $wpvarstoreset. At the end of that for loop, around line 70, I added the following code:

    if (basename($_SERVER['PHP_SELF'])=='index.php'){
    $cat=1;
    }

    In other words, if you’re on the index page, set the category to 1. Different servers and different versions of PHP deal with global variables ($_SERVER, etc) differently, so you may have to tweak that part.
    Then you can have another page (copy and rename the index page, for example) where all category show, or add an extra line of code to set the category to a different number for that page.
    I only just came up with that, and haven’t worked with it much yet, so I’d be interested to know what others have to say, if it works, etc …

    The post at the top could be a sticky post – or even simple HTML in the template.
    The other issue has been dealt with quite a bit on these forums. But these links might help for now:
    https://www.chrisjdavis.org/index/2004/07/15/faking-it-wordpress-as-cms/551/
    https://www.radicalcongruency.com/20040531-tutorial-using-wordpress-to-power-your-non-blog-website

    Keep an eye out for future versions of WP which may have static functionality.
    Dang, I’m such a quidnunc. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Separate page for each category – How?’ is closed to new replies.