Support » Requests and Feedback » Modest proposal – Improve wp-blog-header inclusion

  • I don’t use WordPress. Yet. I need something that more easily does multiple weblogs (I’m going to call them “channels” from here on) on one page, and I have a suggestion that might help do this cleanly.
    An explanation: I would like to have three columns on my site. The center column would contain one or more posts from a specific channel. The left column would contain one or more block areas containing a list of post links. Clicking any post link opens the post as the sole post in the center column. The right side column would contain category listings, calendar, blogroll, etc.
    I don’t see any easy way to accomplish separating WordPress categories into separate physical areas as I’ve described. This seems true because the wp-blog-header file constructs the list of posts at the beginning of the page only once for a specific set of options.
    My proposal is to dissect the wp-blog-header file into two pieces. One piece would produce a $posts array based on parameters passed into a single function (say, generate_posts()). The other piece would automatically construct the correct function call based on the default settings.
    To employ this change to the result in the current default installation’s behavior, a WP user would insert two lines at the beginning of their index.php page in addition to the basic include. The first would construct the corret parameters for the generate_posts() function, the second would be the generate_posts() function itself.
    What is the benefit?
    The site would behave as normal for users who are used to the current installation.
    More advanced users get an additional benefit: Then can re-call the generate_posts() function to get a different list of posts. This would allow a site to display posts from one category in one area, and a different category in a different area.
    By using the new 1.2 heirarchy of categories, the top-level category could be used (by inheritance) to determine in what section on the page the post should appear. Logically, I think this holds water because one would segregate categories in a logical way similarly to how one might arrange them for display on a web page.
    In all, I think this would be a very powerful feature to add, and would seem not to require a massive writing of new code, but a reasonable modification (by classification) of the existing code. It would also provide the “multiple weblog”/channel functionality that blog tools like MT have been providing all along without adding too much extra complication.

Viewing 5 replies - 1 through 5 (of 5 total)
  • This is an interesting suggestion, and it has a lot of merit. But it’s not exactly a multiple blog solution so much as it is more granular output that can be used to simulate multi-blogs in some instances.
    This functionality could greatly serve people looking to integrate ‘linkblogs’ with their main WordPress blogs, though!

    Moderator Ryan Boren


    WordPress Dev

    get_posts() is a modest step toward this. It doesn’t handle everything that the blog-header does, however. It is currently a lightweight affair. Here’s what we can do:
    Bust the query building code from the header out into get_posts().
    Have the blog header collect the stuff coming in from post, get, and path info and pass it to get_posts().
    get_posts() does its thing, building and returning a posts array.
    The blog header stuffs the returned posts array into the $posts global, thus preserving old behavior.
    get_posts() can be called separately by template authors who wish to have multiple post loops.

    There’s a difference between posts/excerpts and links/titles. Links/titles take a lot less resource (size of data) to work with.
    It sounds like you are looking for what is already there, but a three-column design, and cat-posts, recent-posts, etc. blocks in the sidebars. Something like my site ( maybe? BTW, that wasn’t flagrant promotion (I do that in my sig! 😉 ), but trying to understand what is missing.
    wp-blog-header builds a primary list of posts. You can build lists of links pretty easily, and I (and others!) have made different plugins/hacks to do just that, for different cases. I’m not sure what exactly is missing from the world of WP, although some of it is plugins not core (but then, so is a lot of MT).
    If you can give very specific examples, I live to hack WP at this point, and would be happy to take a crack at how you can simply engineer things with the current code as-is.

    skippy: Yes, you’re right, but I think it’s a step toward a working solution. The next step in my mind after this would be to assign user permissions to categories. I feel that this type of feature is important because it fills a popular gap between a clumsy multiple-install of WP to manage more than one weblog/channel/content-area on a single page and multiple installs of WP to accomodate different distinct sites on a single server.
    rboren: As I’ve admitted, I’m not a WP user yet, and so I’m not intimately familiar with all of the tag functions. Your suggestion, now that I’ve seen the source for get_posts(), seems very in-tune with my proposal. get_posts() is not as full-featured as the blog header, but it seems that the author of that function had similar thoughts to mine. I get this impression from the “not implemented yet” comments in the code.
    davidchait: To be clear, I have no interest in “Links” as defined by the WP control panel. When I refer to sidebar links, I refer to things like you have in the sidebar on your site that link to a specific post in my own database, but only draw from a specific category(ies).
    My main… objection(?) is that there isn’t an inherent way of doing anything but displaying the posts as defined by wp-blog-header, and it’s seeming less difficult to get results now after sifting through the source a bit, but it could be much easier.

    Actually, there’s the get_archives function (I think that’s the one) that can get a variety of link lists. there’s mine (and others) same_cat.php type hacks, that give a list of posts matching the currently-shown post (to be shown only when viewing a single post, or passed an explicit category…).
    It could be easier, but WP is still growing. If you have specific sidebar blocks you’re looking for, post away here! I’ve got a bunch of solutions I have made (and continue to make), and with all the hackers around we can create lots of enhancements — sometimes just need the ideas! 😉

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Modest proposal – Improve wp-blog-header inclusion’ is closed to new replies.