• Resolved milangru

    (@milangru)


    Hi,
    I have tried to enable infinite scrolling on my site but haven’t succeed.
    I have created jetpack.php in my theme folder with the next code:

    <?php/**
     * Jetpack Compatibility File
     * See: http://jetpack.me/
     *
     * @package NARGA
     */
    
    /**
     * Add theme support for Infinite Scroll.
     * See: http://wwww.narga.net/how-to-make-your-theme-support-jetpacks-infinite-scroll-feature/
     */
    
    function narga_jetpack_setup() {
        add_theme_support( 'infinite-scroll', array(
            'footer'    => 'footer-info',
            'type'           => 'scroll',
            'footer_widgets' => false,
            'container'      => 'main-content',
            'wrapper'        => true,
            'render'         => false,
            'posts_per_page' => false
        ) );
    }
    add_action( 'after_setup_theme', 'narga_jetpack_setup' );
    ?>
    ?>

    and add code to function.php but infinite scroll don’t appear:

    add_theme_support( 'infinite-scroll', array(
        'container' => 'container',
        'footer' => 'page',
    ) );
    
    function mytheme_infinite_scroll_init() {
    add_theme_support( 'infinite-scroll', array(
    'container' => 'content',
    'render' => 'mytheme_infinite_scroll_render',
    'footer' => 'wrapper',
    ) );
    }
    add_action( 'init', 'mytheme_infinite_scroll_init' );
    
    function mytheme_infinite_scroll_render() {
    get_template_part( 'loop' );
    }

    my site is http://tronline.rs

    https://ww.wp.xz.cn/plugins/jetpack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I’m not really familiar with Divi, so I’m not sure I’ll be able to help here.

    Before you implement Infinite Scroll, you’ll need to check a few things:

    – You only need to declare add_theme_support( 'infinite-scroll' ) once. In the example above, you’ve defined it 3 times.
    – I’d recommend hooking this to after_setup_theme, like you’ve done in the first code snippet.
    – Instead of editing your theme directly, I’d recommend creating a child theme, and placing your code snippet in that child theme’s functions.php file.
    – In the mytheme_infinite_scroll_render() function, you’ve used get_template_part( 'loop' ). Does Divi include a file named loop.php. What’s in that file? Does it include the WordPress loop, as well as functions to render each post inside the loop?

    If you don’t feel comfortable editing PHP files, it might be useful to contact the Divi support team directly about this:
    https://www.elegantthemes.com/forum/

    Their theme might support Infinite Scroll out of the box already, or they might have implemented it for one of their customers already. You could also search their forums for other threads mentioning Jetpack’s Infinite Scroll.

    It’s also worth noting that Divi includes many ways to build a post list and display it on a page, thanks to their Builder tool. It is possible that some of the post list tools can’t support Infinite Scroll.

    I hope this clarifies things a bit.

    Hi,

    I’m looking for the same thing, is it possible to have your finaly code please ? I’m not so familiar to php to find the problem..

    Thanks a much

    • This reply was modified 9 years, 4 months ago by SylvPichot.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Infinite scroll divi theme’ is closed to new replies.