_s: Add basic Infinite Scroll support. Fixes #107. Fixes #105. Props @ethitter.

This commit is contained in:
Philip Arthur Moore 2013-02-03 02:03:40 -05:00
parent c2dca5db27
commit 16906d44c5
3 changed files with 38 additions and 0 deletions

View File

@ -14,6 +14,11 @@
if ( ! isset( $content_width ) ) if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */ $content_width = 640; /* pixels */
/*
* Load Jetpack compatibility file.
*/
require( get_template_directory() . '/inc/jetpack.php' );
if ( ! function_exists( '_s_setup' ) ) : if ( ! function_exists( '_s_setup' ) ) :
/** /**
* Sets up theme defaults and registers support for various WordPress features. * Sets up theme defaults and registers support for various WordPress features.

18
inc/jetpack.php Normal file
View File

@ -0,0 +1,18 @@
<?php
/**
* Infinite Scroll Support
* See: http://jetpack.me/support/infinite-scroll/
*
* Theme Name: _s
*/
/**
* Add theme support for Infinite Scroll.
*/
function _s_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => 'page',
) );
}
add_action( 'after_setup_theme', '_s_infinite_scroll_init' );

View File

@ -554,3 +554,18 @@ object {
#searchsubmit { #searchsubmit {
display: none; display: none;
} }
/* =Infinite Scroll
----------------------------------------------- */
/* Globally hidden elements when Infinite Scroll is supported and in use. */
.infinite-scroll #nav-above, /* Older / Newer Posts Navigation (always hidden) */
.infinite-scroll #nav-below,
.infinite-scroll.neverending #colophon { /* Theme Footer (when set to scrolling) */
display: none;
}
/* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before */
.infinity-end.neverending #colophon {
display: block;
}