Support » Fixing WordPress » Category on front page?

  • snakeyman2


    Is there a way to have a category page as the front page?

    I currently have the standard static frontpage:

    And want to have this instead:

    I haven’t found any plugins to do that. I have tried “List category posts” plugin so that I could insert category posts in a page and then select it as front page, but that does only list links to them.

    Any help much appreciated

Viewing 1 replies (of 1 total)
  • So if you change the setting back to ‘Your Latest Posts’ then that means instead of requesting the page’s content on the homepage you’re back to requesting the latest x amount of posts (default is 10).

    You can then alter the query using the pre_get_posts filter.

    function wp_only_horses( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'cat', '4' );
    add_action( 'pre_get_posts', wp_only_horses' );

    So replace the 4 with the ID of your category.

    In the function we’re saying that we only want posts from that category, and we’re only altering the query if it matches the is_home() condition (which is does when we set the reading settings to your latest post) and then only the main query (i.e. so it doesn’t effect things such as widgets).

    You can paste this code in your functions.php file.

Viewing 1 replies (of 1 total)
  • The topic ‘Category on front page?’ is closed to new replies.