Mornin' folks, I'm not sure how I should explain my problem, well, the basic thing is that I wanted to know if I could display a single category posts on Index.php instead of posts from all categories. Now I've seen some answers already been given to this same question but I'm yet to be satisfied, some answers are not clear to me and some I didn't even get a clue what they were talkin about. A post said I could use a small plug-in but I didn't like it. Is there anyway I could use some sort of loop to display a single category? To be more specific, is there anyway I can use a different template for a different category? Now I know it's possible but I need to learn from the scratch so please keep that on your mind. I'm asking about loops cuz I just thought if it was possible then I could just use another file same as INDEX.PHP to display a specific CATEGORY, which I intend to use as a different site page, if you know what I mean. Anyway, hope I'm making sense. Here's the list of files that I have in my root directory: Index.php Archive.php Single.php Function.php comments.php header.php footer.php searchform.php sidebar.php Thank you~ To MODS: I'm not sure whether this should be in the PHP forum or HTML forum, so please move it to the right forum if needed.
The link leads o a Tom and Jerry website, I'm not sure how it relates to my question. If it's the site that you made with a specific category posts on the index.php then please post the code here. Thank you~
Following will display posts from a category specified by you. <?php $homepage_catg=1; // category id of the category $postslist = get_posts("numberposts=10&category=$homepage_catg"); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="post" > <h2><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> by <?php the_author() ?> </small> <div class="entry"> <?php the_excerpt(); ?> </div> <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> </div> <?php endforeach; ?> PHP: