WordPress.org

Support

Support » How-To and Troubleshooting » It's possible to show in homepage the articles of only one category?

It's possible to show in homepage the articles of only one category?

  • delizard

    @delizard

    Hi,

    it’s possible set WordPress to show in Homepage the article list only of one category (main category)? And, if user wants to read the articles of other categories “click” on the each category name in the menΓΉ…
    I’d like don’t mix the articles of differents categories…
    It’s possible? I hope yes πŸ™‚

    Thanks,
    bye bye!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Bea Cabrera

    @bea-cabrera

    Of course it’s possible, but you’ll have to learn about your loop queries first!

    I’m assuming that you’re not very familiar with it, so here’s a link:
    http://codex.wordpress.org/The_Loop

    Before entering the loop (in your index.php or home.php) you will want to make a query to filter by category. Your query could look like this (take a look at this link for more info: http://codex.wordpress.org/Function_Reference/query_posts):

    query_posts( $query_string . '&cat=13' );

    But you only want it to happen on your homepage so can make use of conditional tags like is_home() (more on Conditional Tags: http://codex.wordpress.org/Conditional_Tags):

    if ( is_home() ) {
    	query_posts( $query_string . '&cat=13' );
    }

    So, there you are, something new to study!

    Good luck!

    esmi

    @esmi

    Forum Moderator

    Yes – this is possible via a custom query in the relevant template file of your theme’s main posts page (index.php?). You’d need to create a query that limited to the display to one category using the cat or category_name parameters. See:
    http://codex.wordpress.org/Function_Reference/query_posts
    http://codex.wordpress.org/Function_Reference/WP_Query (ofr a list of possible parameters).

    However, depending on your theme, you may need to do this customisation via a child theme.

    delizard

    @delizard

    Hi,
    thanks “bea Cabrera” and “Esmi” πŸ™‚

    Yes, i’m not familiar with WordPress, so i have to stydy πŸ™‚

    If i’ll have some problems i come-back to this discussion!

    Thanks,
    bye bye!

    delizard

    @delizard

    Hi,
    I forgot a little question related to the previous post: it’s possible to obtain distinct RSS Feed of the articles, one for each category?

    Thanks,
    bye! πŸ™‚

    Bea Cabrera

    @bea-cabrera

    I’m not sure about that, I have never looked into RSS. Sorry.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘It's possible to show in homepage the articles of only one category?’ is closed to new replies.
Skip to toolbar