• Resolved Nick Ottens

    (@ottens)


    I’ve created a separate template for search results at my site in order to show only the title, meta data and summary.

    The relevant code from my search.php looks like this:

    <?php /* Start the Loop */ ?>
    
    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php get_template_part( 'content', 'search' ); ?>
    
    <?php endwhile; ?>

    And then the template is in content-search.php.

    This works as expected on the first page of search results, but as soon as you get to Page 2 the posts switch to the regular template.

    I wonder if it might have something to do with infinite scroll, but I’m not sure.

    Any ideas?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes, it’s likely infinite scroll. By default search.php should be used for all pages of search results. With infinite scroll, there shouldn’t even be links with page references, though I suppose such links could be converted to skip down to the related position on the first and only page. It would be up to the infinite scroll plugin to manage or suppress paged requests. This is something best taken up with the authors of your infinite scroll plugin.

    Thread Starter Nick Ottens

    (@ottens)

    I’ll do that, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search results switch template on Page 2’ is closed to new replies.