• Hi,
    I created a child theme of Oblique and set a custom front page by a written a front-page.php.
    In my front page, I insert such code to display a recent post list like this:

    <div id="news-grid" class="grid-layout"> 
        <?php
        $catName = 'news';
        $query = new WP_Query( array(
            'post_type' => 'post',
            'category_name' => $catName,
            'posts_per_page' => 8
        ) );
    
        while ( $query->have_posts() ) : $query->the_post();
            get_template_part( 'content', get_post_format() );
        endwhile; 
        ?>
    </div>

    The list loads very slow and I found that if I remove the “class=”grid-layout”” in div, the posts will show in normal speed but lost all styles.

    Any one can help me? Thanks a lot!

    My site: http://catheaven.studio/

Viewing 3 replies - 1 through 3 (of 3 total)
  • We use a JavaScript library for the layout and it triggers after all the posts and images are loaded, so that’s why it takes some time. There really isn’t a way for us to solve it, unfortunately.

    Thread Starter catheavenstudios

    (@catheavenstudios)

    Could you please tell me what javascript is called when I load the grid? I want to see if I can do something to it.Thanks anyway.

    Thread Starter catheavenstudios

    (@catheavenstudios)

    Problem solved, I create a new layout class in style.css and use that class instead of “grid-layout” class, then all performance problems gone.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loading posts grid too slow in custom front page’ is closed to new replies.