WordPress.org

Ready to get started?Download WordPress

Forums

Hot to avoid articles in blog's home page (9 posts)

  1. guastatore
    Member
    Posted 8 years ago #

    Hi everybody,

    Is there a way to avoid some of articles of mine are in my blog's home page ? I mean, I have four categories and for one of this I would like that articles would stay just there.

    Thanks
    guastatore

  2. MichaelH
    Member
    Posted 8 years ago #

    Take a look at what this example The_Loop#Exclude_Posts_From_Some_Category.

    Or consider a plugin here:
    Plugins/Restriction

  3. Carcasherdotcom-Seocontest
    Member
    Posted 8 years ago #

    I'd try some plugin, there are a few out there to customize listings.

  4. pati
    Member
    Posted 8 years ago #

    Hi!

    I've read the example on the link you gave and use it now in my code. I, though, have a question: When I use the code the posts aren't printed, but there is still kind of placeholder for them. Other posts will show up after clicking several times next page (because they are posted much earlier). Any idea how to trick wordpress?

    tia,
    pati

  5. MichaelH
    Member
    Posted 8 years ago #

    pati: what code did you use and where did you put that code. If necessary use http://pastebin.com/ to paste code can report that URL back here.

  6. pati
    Member
    Posted 8 years ago #

    hello again!

    i've tried three things:

    1.) <?php if (is_home()) { query_posts("cat=-3"); } ?> ==> excludes the category, but you can't use prev/next function. the code is written directly before the loop.

    2.) if(is_home()) { $wp_query->set('cat','-11'); query_posts(''); } ==> excludes a category and you can use the prev/next function. but need to exclude more than one category (any ideas?). the code is also written driectly in front of the loop.

    3.) i used the code from this link: http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

    with the result i posted before. put the code a shown in the example. closed also the if-statement. but problem with this code ist, that it leaves the place of the posts for the excluded categories blank. you know, you had a lot of white space, where is no post. but you can use the prev/next function and then - after some clicking - you'll find a post of a not excluded category.

    i'll try to put the code to the link you gave me, too.

    thx,
    pati

  7. pati
    Member
    Posted 8 years ago #

    number two from above:

    http://pastebin.com/628273

    highlighting with @@ didn't work.

    tia :)

  8. pati
    Member
    Posted 8 years ago #

    Hi again!

    I have a solution for my problem now. it isn't the best way, but it works.

    For excluding multiple categories I created a category "hidden", where I put all the other categories which shouldn't be displayed on the index.php. After this I excluded the category "hidden" with the following peace of code in front of the loop:

    <?php if(is_home()){$wp_query->set('cat','-14'); query_posts('');}?>

    Now you have only the categories, which you want see on your index.php and you still can use the prev/next function (working without error!).

    greets,
    pati

  9. Phoat
    Member
    Posted 7 years ago #

    I just discovered this today on my own but I think I did it in a more complicated way.


    Here's
    what I did...

Topic Closed

This topic has been closed to new replies.

About this Topic