only one category posts on home page

Discussion in 'BlogsTrend WordPress Theme' started by danteunipv, Mar 1, 2017.

  1. danteunipv

    danteunipv Member

    Joined:
    Feb 3, 2015
    Messages:
    59
    Likes Received:
    1
    Dear Friend,

    Can I have only one category posts on home page?
    Can you give me the code?
    Link web site: http://webing.unipv.eu/home/

    Thanks and regards

    Dante
     
  2. nitin

    nitin Guest

    Hi Dante,

    Greetings from InkThemes,

    To make the required changes just replace the blog section in index.php file of the theme with the code given below:-

    Code:
    <div class="blog">
                    <!--Start Post-->
                    <?php
                    $args = array(
                        'category__in' => '32',
                        'post_type' => 'post',
                        'post_status' => 'publish',
                    );
                    $wp_query = new WP_Query($args);
                   
                    get_template_part('loop', 'index');
                    ?>
                    <!--End Post-->
                    <div class="clear"></div>
                    <?php inkthemes_pagination(); ?>
                </div>
    
    Replace the '32' in the above code with the category ID of your desired post category whose post you want to show.

    Hope this helps...!

    Thanks & Regards!
    Nitin
    InkThemes.com
     

Share This Page