WordPress.org

Ready to get started?Download WordPress

Forums

It's possible to show in homepage the articles of only one category? (6 posts)

  1. delizard
    Member
    Posted 1 year ago #

    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!

  2. Bea Cabrera
    Member
    Posted 1 year ago #

    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!

  3. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    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.

  4. delizard
    Member
    Posted 1 year ago #

    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!

  5. delizard
    Member
    Posted 1 year ago #

    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! :)

  6. Bea Cabrera
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic