Show specific category on front page (4 posts)

  1. SjoerdHuisman
    Posted 4 years ago #

    Dear code-gods of the wordpress support forum,

    I'm busy with designing a website for a client of mine. The webadres is http://www.eentweehupsakee.com. As you can see, the front-page shows the last 4 newly added posts. I want the theme to only show posts from a specific category in these 4 items. I'm using a custom theme named "Widely". I'll post the code from the front-page.php file below.

    I'm not an experienced coder so I would like to know which piece of code I have to put where in the php file to get everything to work.
    Hopefully you masterminds can help me out! I would be eternally greatful!

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

  2. esmi
    Forum Moderator
    Posted 4 years ago #

  3. SjoerdHuisman
    Posted 4 years ago #

    Esmi thanks for the reply, but as I said, I don't know where to put it in this existing code.. I am not a php programmer. Thanks anyway.

  4. SjoerdHuisman
    Posted 4 years ago #

    Esmi I read the page and have found out on my own that I had to change this line. thanks for the reference.

    $args=array('cat'=>$include_category, 'post_status' => 'publish','paged' => $paged,'posts_per_page' => 4,'ignore_sticky_posts'=> 1);

    in to

    $args=array('cat'=> 6, 'post_status' => 'publish','paged' => $paged,'posts_per_page' => 4,'ignore_sticky_posts'=> 1);

Topic Closed

This topic has been closed to new replies.

About this Topic