Latest News

How can I get the latest news on the home page to only show posts in a specific category?

Comments

  • Hi, @craigmckee

    kindly confirm, means you want to show posts on the homepage of a specific categories only.

    Thanks


  • So rather than all posts, what if I just wanted the latest news widget to show the most recent posts from the "featured" category?
  • Hi, @craigmckee

    This feature to show posts of specific categories is not included in the theme. However, you can do this but you need to add some code manually in a file.

    Follow the below steps:

    1) Install a plugin Reveal IDs

    2) Create a child theme if not created. 

    3) Copy the file index-recentblog-old.php from parent theme of Rambo & paste it in the child theme.

    4) Now edit the file, at line no. 17 you will notice this below line
    $args = array( 'post_type' => 'post','posts_per_page' =>$no_of_post,'post__not_in'=>get_option("sticky_posts"));

    In that line, add one more parameter & it become like this. Or replace the whole line with below line
    $args = array( 'post_type' => 'post','posts_per_page' =>$no_of_post,'post__not_in'=>get_option("sticky_posts"),'cat'=> '7,8');

    You will notice only ,'cat'=>'7,8' is added. where the value 7 & 8 are two category Id which you want to show on homepage posts.
    Above plugin add one column which reveals ID like this http://prntscr.com/ia8xea

    This way you can customize feature to show only specific categories on homepage.

    Let me know if further need assistance.

    Thanks
  • Thank you. 

  • Glad to know it is useful to you.

    Any query later, feel free to ask again!

    We would really appreciate if you could provide us a kind review here:

    Thanks
This discussion has been closed.