I want to add IS support for search pages as well. I added the code above but my pages wound up being blank, white and empty. After changing the function name, the pages load, but IS isn’t activating. Got any tips? I’m using a child theme with twentytwelve.
(I’ve seen your support elsewhere on the forum and I want to thank you for all of it. I’ve gotten a lot of help from your responses elsewhere).
Here’s the code I plopped into functions.php (including my initialization code).
function ftchild_twentytwelve_setup() {
add_theme_support(
'infinite-scroll',
array(
'posts_per_page' => 1,
'container' => 'infinite-content',
'wrapper' => false
)
);
}
add_action( 'after_setup_theme', 'ftchild_twentytwelve_setup', 12 );
// Add infinite scroll support to search pages
function add_infinite_to_search() {
$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_search() );
return $supported;
}
add_filter( 'infinite_scroll_archive_supported', 'add_infinite_to_search' );
I see line 976, and it looks like search might have IS functionality by default. Is that true?
/**
977 * Allow plugins to filter what archives Infinite Scroll supports
978 *
979 * @uses current_theme_supports, is_home, is_archive, apply_filters, self::get_settings
980 * @return bool
981 */
982 public static function archive_supports_infinity() {
983 $supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_search() );
984
985 return (bool) apply_filters( 'infinite_scroll_archive_supported', $supported, self::get_settings() );
986 }