I believe that it still has yet to be written?
But this link has some info:
http://ww.wp.xz.cn/support/topic.php?id=29322
Thread Starter
Rik
(@rik)
I am surprised that WP 1.5 does not already have a built in ability to default to a particular category. Sure looks messy to throw all my posts on the index page.
For now, I don’t think I have the talent to make this happen.
I added additional categories thinking it would be a good thing, but it just makes a mess as it is.
It’s quite a bad (IMO very bad) idea to put all your posts on the index page. I always consider it a great disrespect toward visitors to have 30-40-50-100 posts on the frontpage!
[To be honest, when this is the case I hit the Back button and never bother offer any help…]
Thread Starter
Rik
(@rik)
I agree, how do I NOT do it?
I would prefer to default to one category, let the visitor choose other categories if interested.
Limit the number of posts shown. Options > Reading
Rik,
Here’s a step-by-step to accomplish what you’re after:
1. Make a copy of the index.php in your theme’s directory, and name it “home.php”.
2. Edit home.php, and put this on the line *just before* the start of The Loop:
<?php query_posts('cat=ID#'); ?>
Change ID# to the numeric ID of the category you want displayed on the home page. You can also use the “nicename” or category slug for the category:
<?php query_posts('category_name=my-home-cat'); ?>
3. Save it to your theme’s directory.
4. There is no step 4.
Thread Starter
Rik
(@rik)
Thanks
created home.php (moved index.php out of the theme directory just to be sure)
inserted code, now have this:
<h1 id=”header”>“><?php bloginfo(‘name’); ?></h1>
<div id=”content”>
<?php query_posts(‘cat=1’); ?>
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
I see no difference. When you go to my blog, posts from all categories are displayed.
Try $myposts = query_posts(‘cat=1’);
and
foreach ($myposts as $post) : start_wp();
Might work. User http://www.cenamayo.com/wpxref which sort of auto-documents the source.
The problem with the way you have it above is that you’re using the 1.2 loop form, which is ignorant of query_post. The start of The Loop in 1.5 is:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Obviously it ends a bit differently, too. Anyway, Carthik’s example should work.
Thread Starter
Rik
(@rik)
I’ll try it. The theam was brought over from my old 1.2 install.
Thread Starter
Rik
(@rik)
I upgraded the Loop code in my theme’s home.php to the 1.5 code, then inserted the
<?php query_posts(‘cat=ID#’); ?>
just before the loop.
This worked perfectly. Now my blog opens defaulted to my main category.
Thanks very much.