Skip to content

Instantly share code, notes, and snippets.

@zeropointdevelopment
Last active January 1, 2016 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeropointdevelopment/8142780 to your computer and use it in GitHub Desktop.
Save zeropointdevelopment/8142780 to your computer and use it in GitHub Desktop.
[WordPress] Code from our blog post Using the Infinite Scroll Module in JetPack - http://www.limecanvas.com/using-the-infinite-scroll-module-in-jetpack/
/**
* Add support for JetPack infinite scroll
**/
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => 'page',
)
);
/**
* Add theme support for infinite scroll
*
* @uses add_theme_support
* @action after_setup_theme
* @return null
*/
function twenty_twelve_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content'
) );
}
add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' );
/**
* Add theme support for infinity scroll
*/
function twenty_eleven_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer_widgets' => array( 'sidebar-3', 'sidebar-4', 'sidebar-5' ),
'footer' => 'page',
) );
}
add_action( 'init', 'twenty_eleven_infinite_scroll_init' );
/**
* Add theme support for infinity scroll
*/
function twenty_ten_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'render' => 'twenty_ten_infinite_scroll_render',
'footer' => 'wrapper',
) );
}
add_action( 'init', 'twenty_ten_infinite_scroll_init' );
/**
* Set the code to be rendered on for calling posts,
* hooked to template parts when possible.
*
* Note: must define a loop.
*/
function twenty_ten_infinite_scroll_render() {
get_template_part( 'loop' );
}
/* Infinite Scroll */
/* Hides navigation links and site footer when infinite scroll is active */
body .infinite-scroll .navigation,
body .infinite-scroll.neverending #footer {
display: none;
}
/* Shows the footer again in case all posts have been loaded */
body .infinity-end.neverending #footer {
display: block;
}
/* Infinite Scroll - footer content */
#infinite-footer .container{
width: 960px !important;
background-color: #a9cf38;
border-top: 1px solid #7f9c2a;
color: #fff;
}
#infinite-footer .container a{
color: #fff;
}
#infinite-footer .container a:hover{
text-decoration: underline;
color: #fff;
}
/* Inifnite Scroll - Spinner */
.infinite-loader{
color: #929292;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment