Latest news settings - selectively show only one catagory on main page

Hi, how can I only show 1 of my 4 catagories of Post on the main page under Latest news settings? By default all catagories are listed.
Thanks!
Flemming

Comments

  • Hi, @fcassee
    Thanks for asking query again. 

    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. 


  • edited December 1
    3) Copy the file index-blog.php from parent theme of Quality  & paste it in the child theme.

    4) Now edit the file, at line no. 30 you will notice this below line
    $args = array( 'post_type' => 'post','posts_per_page' =>4,'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' =>4,'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
  • Thanks. It is not clear why I need to create a Child Theme. What you ar esaying is that I can simply replace
    $args = array( 'post_type' => 'post','posts_per_page' =>4,'post__not_in'=>get_option("sticky_posts")); 
    into
    $args = array( 'post_type' => 'post','posts_per_page' =>4,'post__not_in'=>get_option("sticky_posts"),'cat'=> '7,8'); 

    in the theme's index-blog.php  file right. I mean, It works in the child theme that I created but than I need to change all other setting in the Theme as well as e.g. Team picture are not transfered to the Child Theme.

    Or will the index-blog.php   be overwritten when a newer version of Quality Pro Theme is installed?

    regards

    Flemming


  • Hi 
    If  you dont use child theme  then whenever you update theme with latest version in that case  your changes  will lost .
    SO to prevent lost of changes when you update theme , you much have to use child theme.

    If you  use child theme all settings of the parent theme will remains same.

    Let me know if you have any confusion.

    Thanks 
    AKhilesh
  • Ok but then I cannot benefit from the advantages of an update, right? Or ... don't update the Theme with a new version :-)

    Flemming
  • Hi 
    If you dont want to update theme, then you can made changes into the parent theme file directly.

    Thanks
    Akhilesh
This discussion has been closed.