Support » Themes and Templates » Two separate blogs (from separate categories) on o

  • Hi,
    I want to set up a site that show two different categories within WordPress in different columns on the home page, and I’m trying to make sure I can do it fairly easily before choosing WordPress for this site and diving in.
    For example, the left column would show the posts from the “general” category, and the right column would show the posts from the “stupidstuff” category.
    I found this page in the wiki: which is how to hardcode the front page to a specific category.
    I’m guessing if I set $cat to one category in index.php, I can then run through the foreach $posts loop (the main loop) in one column, and then in the next column’s code, reset $cat to something else and do that foreach loop again.
    Will that work? Does $posts have every post in the DB by that point, or is it limited to a specific category from some earlier function? Now that I think about it some more, the latter makes more sense. If that is the case, can I repopulate $posts with a different category later in the page?
    Or, is there a better way to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Ok, I looked at the code a bit more, and found the SQL query in wp-blog-header.php.
    I’m now wondering if the easiest way might just be to change the code in that file to automatically do two queries for the two categories I want, and return two different $posts variables, one for each category. Then I could easily loop through one for each column of the home page.
    That doesn’t sound too bad, except for when I want to upgrade WP, since I’d have changed one of its core files…
    Anyone out there who’s more familiar with WP (I’ve only played with it a bit on know of a better way?

    This was just asked and answered elsewhere. Basic quick answer was: RSS feed aggregation of your own site, re-include wp-blog-header a second time, or simply hard-code your own custom query inside index.php to get the posts you want, and do a custom posts loop for them.

    I am in the middle of trying to code a loop for just one category…
    if i could just get one, then i could easily set up another loop.
    anyone feel like repeating themselves? the only posts about multiple categories on the index.php that i have found seem to all say that the question was just answered.
    some, like this, vaguely describe the solution.
    but none actually present it (in a way that i can grasp:: and me, well, it’s amazing i can even turn my computer on, type or anything!)

    This is not a php solution, it’s not even a solution from within the wp files.
    but it works.

    actually it doesn’t work very well.
    this script does a fine job of displaying through java your whole blog’s headlines or abreviated entries, but when you categorize it, somehow it goes wrong and only displays a single post.
    no dice.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Two separate blogs (from separate categories) on o’ is closed to new replies.