WordPress.org

Forums

Questions about sorting by category on a static HTML page (2 posts)

  1. sphere51185
    Member
    Posted 2 years ago #

    So I never ever like to ask for help with code, I prefer just to figure it out myself... After a few weeks, I'm stumped.

    I have an HTML website that uses a WordPress blog. We have four sections on the index.php page that need to be populated by small excerpts from different categories.

    There is a News and Events category, and then three topic categories (Social Media, Blogs, etc. etc)

    The code that I'm using is --

    <?php
        require('blog/wp-blog-header.php');
        ?>
    
    <?php query_posts('cat=8&posts_per_page=6'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <img src="images/img_1.gif" alt="pisture" border="0" class="floated" /><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><strong><?php the_title(); ?></strong><?php the_excerpt(); ?></a><br />
    <?php endwhile;?>

    Somehow I deduced that my "category ID" was 8. I don't think that is true anymore. I can't find any how-tos, guides, or anything that will tell you how to find Category IDs anymore. The techniques "hover your mouse over... " etc don't seem to work anymore and it no longer shows up on the HTML byline.

    I know this is really, really, really, really, simple, but can I divide up my index.php so that it pulls content for the four separate sections from the four separate categories? And how do I find the category IDs to use in the sorting?

    Sorry, I know this is a repost but I can't find it, and if I have found it then I don't understand it.

    THANKS!

  2. sphere51185
    Member
    Posted 2 years ago #

    A bit more info....

    I just remembered that i found the Category IDs when I clicked on "categories" and scanned the HTML while hovering over the categories... Am I doing this the most efficient way? Some of this content needs to be title only, while some of it needs to be title and excerpt... Another problem is that some of the divisions may need to have more or less than the 55 word except, but if I edit functions.php it is only giving me a place to change it overall.

Topic Closed

This topic has been closed to new replies.

About this Topic