Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsBlog Module
How to Customize the Blog Module to Include Infinite Scrolling
How to Customize the Blog Module to Include Infinite Scrolling

Learn how to customize Divi's Blog Module to include infinite scrolling for a seamless and engaging user experience.

Updated over 3 months ago

The Blog module doesn't include infinite scrolling functionality out of the box. In the following article, we will use the YITH Infinite Scrolling plugin to enable infinite scrolling on the Blog module.

For this to work correctly, we must use the Fullwidth Layout for the Blog module. The Grid layout will be recreated using custom CSS.

  1. Install and activate the YITH Infinite Scrolling plugin.

  2. Open the Row's settings (that contains the Blog module), go to Advanced Tab → CSS ID & Classes → CSS Class, and type in divi_infinite_blog_wrapper

    Row's custom CSS class

  3. Open the Blog module settings, and in the Content Tab → Post Count, set it to 9 or any other multiplier of 3. The value should not be less than 9 for the Infinite Scrolling to work correctly.

  4. Go to Design Tab → Layout and choose Fullwidth.

  5. Go to Advanced Tab → CSS ID & Classes → CSS Class and type in: divi_blog_infinite_scroll

    Set the CSS class on the Blog module

  6. Go to Advanced Tab → Custom CSS → Free Form CSS and paste in this CSS snippet:

    selector .et_pb_ajax_pagination_container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    }

    selector .et_pb_ajax_pagination_container .et_pb_post {
    margin-bottom: 0;
    border: 1px solid #ddd;
    padding: 30px;
    }

    selector .et_pb_ajax_pagination_container .et_pb_post .entry-featured-image-url {
    margin: -30px -30px 30px -30px;
    }

    @media (min-width: 768px) and (max-width: 980px) {
    selector .et_pb_ajax_pagination_container {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    }

    selector .et_pb_ajax_pagination_container .et_pb_post {
    padding: 20px;
    }

    selector .et_pb_ajax_pagination_container .et_pb_post .entry-featured-image-url {
    margin: -20px -20px 20px -20px;
    }
    }

    @media (max-width: 767px) {
    selector .et_pb_ajax_pagination_container {
    grid-template-columns: repeat(1, 1fr);
    gap: 30px;
    }
    }

  7. Go to WordPress Dashboard → YITH → Infinite Scrolling.

    Open the Inifinite Scrolling settings page

  8. Set the following CSS selectors:

    1. Navigation Selector: .divi_blog_infinite_scroll .pagination

    2. Next Selector: .divi_blog_infinite_scroll .pagination .alignleft a

    3. Item Selector: .divi_blog_infinite_scroll .et_pb_post

    4. Content Selector: .divi_infinite_blog_wrapper

    Infinite scrolling settings

Important note: Since this customization is using the CSS Grid to create the grid layout for the Blog Module, some of the properties used will be displayed with CSS warnings. Those can be safely ignored. The CSS code provided is 100% valid.

The result can be seen in the GIF below:

Blog Module with Infinite Scrolling
Did this answer your question?