Sugar and Spice
[resolved] Limit number of posts visible on first page (4 posts)

  1. savannahdaras
    Posted 1 year ago #

    Hi there,
    I was wondering if there is a way to limit the number of posts visible on the home page?
    My site: http://wanderlustingwonders.com/

    I just don't want the posts going past the side bar content, as it looks weird and empty once the side bar content disappears and you scroll past it.

    Also, is there a way to have the home page look as it does now with the right side bar and the posts, but then when a specific post is selected, it displays the entire post in full format without the side bar? (hopefully that makes sense).

    Thank you!

  2. kaniamea
    Posted 1 year ago #


    in order to change the number of posts visible on the homepage you can put your theme index.php file in your child folder (assuming you are working with a child theme). Then find <?php if ( have_posts() ) : ?>. It is around line 18. Right before this line put this <?php query_posts('showposts=3'); ?>. This will display 3 posts. You can adjust this number to whatever you like.

    Regarding your second question, are you trying to remove the sidebar from all posts but the homepage? If so, move your sidebar.php file to your child theme. Then put this code as the first line <?php if ( is_front_page() ) { ?> and this code <?php } ?> at the end of the page, after the last line. This will remove the sidebar from all posts but the homepage.

    Now you only have to adjust the width of the post pages by adding this code to your child style.css:

    #primary {
        width: 100%;
    .home #primary {

    I hope this helps.

  3. alex27
    Theme Author

    Posted 1 year ago #

    You can limit number of posts displayed on home page & category/archives pages from Settings > Reading in your dashboard, no child theme needed for that.

  4. savannahdaras
    Posted 1 year ago #

    Perfect - thank you all for your help! :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic