Support » Fixing WordPress » Categories in Front Page…. confused

  • Resolved yorgict

    (@yorgict)


    Hi all,

    I looked for an answer to this but my front page has this:

    <h7 align="center">LATEST NEWS</h7>
    
                              <?php if (have_posts()) :?>
    
                <?php while (have_posts()) : the_post(); ?>
    
    				<div class="post-wrapper">

    Based on the above (and I have tried to no avail) how do I limit the categories in the front page. In other words if I wanted any category “Latest News” on the front and the other info on the inside. How does this happen? I even tried with another template with this breakdown:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    Still confused.

    Please help.

    Thanks
    Yorgi

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can restrict the categories displayed in your front page by using in_category() in the loop.
    At the codex:
    http://codex.wordpress.org/Template_Tags/in_category

    Sorry but I tried this:
    <h7 align=”center”>LATEST NEWS</h7>

    <?php if (in_category(‘3’)) :?>

    <?php while (in_category(‘3’)) : the_post(); ?>

    Did I miss something after looking at the page shown.

    Yorgi

    <?php if (have_posts()) : php while (have_posts()) : the_post(); ?>
      <?php if (in_category('3')) { ?>
        <!-- stuff here -->
      <?php } ?>

    From http://codex.wordpress.org/Template_Tags/in_category:

    Normally, this tag must be used inside The Loop because it depends on a WordPress PHP variable ($post) that is assigned a value only when The Loop runs.[..]

    Got it Thanks it worked.

    G

    I know I am not supposed to say I am new to WordPress, but I am – brand new. We’ve added a blog to our site (www.helloboquete.com) using WordPress, but we cannot find out how to display our categories in the left sidebar. We have researched it now for hours and can’t find any info at all. Everything we try fails. Truly appreciate someone “in the know” steering us in the right direction.

    We are also worried, now that we FINALLY got our flash menu working on the page, what will happen if we upgrade the version? We will lose everything we worked so hard to get?

    Thanks.

    I’ve tried using in_category(x), however it doesn’t seem to work; I essentially want two pages, one that lists entries in a ‘Blog’ category, and another in ‘Articles’.

    Looking at the database, it looks like all of the entries seem to have post_category set to 0. I’m pretty sure that this shouldn’t be the case.

    Can anybody suggest any ideas?

    Solved: I used Advanced Category Excluder to remove the other posts from the front page, and PostLists to create pages with lists of other posts on them, works a treat.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Categories in Front Page…. confused’ is closed to new replies.