Forums

Can I choose what category posts to show on the first page? (7 posts)

  1. Lennart Pettersson
    Member
    Posted 2 years ago #

    I dont want certain categories postings to show on the first page, how can I change this?
    Appreciate all help!
    Thanks

  2. SleepW
    Member
    Posted 2 years ago #

    Add the following line to Index.php (in your theme) in between the get header and have posts lines. using your categories numbers of course

    `<?php get_header(); ?>

    <?php query_posts($query_string . "&cat=-23,-20"); //Block categories 20 and 23 from main page ?>

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

  3. Lennart Pettersson
    Member
    Posted 2 years ago #

    Thanks!

    Another question about posts; how do i set a limit on how many posts shown on the first page but not limit the number of posts shown when go to a category?

    Thanks again

  4. SleepW
    Member
    Posted 2 years ago #

    i think there's a limit-post plugin ..not sure.

  5. Lennart Pettersson
    Member
    Posted 2 years ago #

    I installed one out but it didnt work for me.
    I will continue to look for it. Thanks

  6. SleepW
    Member
    Posted 2 years ago #

  7. nikoklein
    Member
    Posted 2 years ago #

    One addendum: I had to insert this additional code to make sure the category pages that linked through index.php didn't also redact the categories I wanted to eliminate from my first page. See below:

    <?php
    $homepage = "/";
    $currentpage = $_SERVER['REQUEST_URI'];
    if($homepage==$currentpage) { query_posts($query_string . "&cat=-3,-5"); }
     //Block categories 3, 5 from main page
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic