• Hi everyone, I’ve just installed my first WordPress, very nice.

    Currently I have two categories labeled: News and Articles. When you load up the index page it shows the posts from both these categories, is there a way so only the News posts show on the index page?

Viewing 7 replies - 1 through 7 (of 7 total)
  • See if the examples of The Loop help.

    Thread Starter AnthonyC

    (@anthonyc)

    Thanks, got it working.

    Hi!

    I want to do the same thing, but it’s not working for me. I’m a newbie so the solution is hard to find..

    Here’s my code from the index.php

    _________________________

    <?php if (have_posts()) : ?>

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

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
    <small><?php c2c_the_author_image(); ?><br><?php the_time(‘l j. F Y,’) ?> kl <?php the_time(‘H:i’) ?></small>

    <div class=”entry”>
    <?php the_excerpt_reloaded(70, ‘<img><br>’, ‘content’, TRUE, ‘| Les mer |’, FALSE); ?>

    </div>

    <p class=”postmetadata”>H??rer til i <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Rediger’,”,’|‘); ?> <?php comments_popup_link(‘Ingen tilbakemeldinger »’, ‘1 tilbakemelding »’, ‘% tilbakemeldinger »’); ?>
    </div>

    <?php endwhile; ?>

    _________________________

    I guess the example in The Loop help is working, but as you can see I have modified my code so I don’t want to just copy and paste the example code (I don’t want to lose what I’ve modified). I tried to implement the example code into the code above, but I got errors and since I’m a newbie I don’t know how to get it to work. Can anyone help please?

    Thanks in advance ??

    Anyone? Sorry if I’m impatient..

    To AnthonyC and Jorgent, try this plugin:

    https://www.nmyworld.com/wordpress/2005/04/elegant-category-invisibility-69/

    I?′m using it in my blog, to show only “news” categories on the frontpage, and left the rest for viewing by a direct link for their categories (normal, or childs). It?′s works perfect ^^.

    Thanks for the link Madcore! It’s exactly what I’m looking for, but it seems like it doesn’t work without the default permalink structure. I get 404 errors when I click on my post titles. I don’t want to remove my permalink structure.. Too bad if I can’t use this great plugin ??

    Sorry about the nagging, but I really want this to work ?? I’m using this permalink structure: /%year%/%monthnum%/%day%/%postname%/

    The plugin seems to work, but when I click the post titles or the “read more” button, I get a 404 error. When I look at the url it looks like a permalink problem. I guess everything would work nice if I removed the structure, but I don’t want to do that cause I need it for statistics etc.

    Can anyone please help me? Thanks in advance ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show posts only from select catergory on index.php?’ is closed to new replies.