• Resolved Reiniepress

    (@reiniepress)


    Hi, me again…

    In my search page I append an .odd and .even class to the article so as to change the background. I also insert another article now and then, every 7 posts (an add) with php. But it works on the first page (before scrolling).
    The infinite scroll seems to only load the default content on the second pages and the rest… my extra php doesnt seem to be taken into account as the extra articles are not loaded either.

    What would I need to change to run the extra php in the loader ?
    Hope I make sense.

    Thanks again.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author mrwweb

    (@mrwweb)

    @reiniepress, as best I know, this is not really a Blogsonry issue. You’ll need to poke around the Jetpack Infinite Scroll documentation and possibly contact their support if you can’t figure it out.

    Infinite Scroll requests posts via AJAX, so I’m not too surprised that it might not pick up on the changes you’re making.

    Thread Starter Reiniepress

    (@reiniepress)

    ok thanks for the direction I’ll keep on digging. Will post the answer here.

    Thread Starter Reiniepress

    (@reiniepress)

    Found the answer, as I suspected it loads the default content. So we need to change the render option

    add_theme_support( ‘infinite-scroll’, array(
    ‘type’ => ‘scroll’,
    ‘footer_widgets’ => false,
    ‘container’ => ‘content’,
    ‘wrapper’ => true,
    ‘render’ => false,
    ‘posts_per_page’ => false,
    ) );

    render
    Infinite Scroll uses a standard WordPress loop to render the additional posts it appends, and utilizes template parts in the content-{post format}.php form. If a theme includes at least content.php, then the render argument can be omitted. Below is the default rendering function Infinite Scroll uses:

    while( have_posts() ) {
    the_post();
    get_template_part( ‘content’, get_post_format() );
    }

    If greater customization is needed, or a theme doesn’t use the content template parts, a function name should be specified for the render argument and that function will be used to generate the markup for Infinite Scroll. The function must include the while() portion of WordPress’ loop and can utilize any function available to the theme when it renders posts.

    https://jetpack.com/support/infinite-scroll/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘infinite scroll and custom loop’ is closed to new replies.