Last active
January 1, 2016 12:09
-
-
Save zeropointdevelopment/8142833 to your computer and use it in GitHub Desktop.
[WordPress] Code from our blog post Customising the JetPack Infinite Scroll Footer - http://www.limecanvas.com/customising-the-jetpack-infinite-scroll-footer/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The Infinite Blog Footer | |
* | |
* @uses self::get_settings, self::set_last_post_time, self::archive_supports_infinity, __, wp_get_theme, get_current_theme, apply_filters, home_url, esc_attr, get_bloginfo, bloginfo | |
* @return string or null | |
*/ | |
function footer() { | |
// Bail if theme requested footer not show | |
if ( false == self::get_settings()->footer ) | |
return; | |
// Bail if there are not enough posts for infinity. | |
if ( ! self::set_last_post_time() ) | |
return; | |
// We only need the new footer for the 'scroll' type | |
if ( 'scroll' != self::get_settings()->type || ! self::archive_supports_infinity() ) | |
return; | |
$credits = '<a href="http://wordpress.org/" rel="generator">Proudly powered by WordPress</a> '; | |
$credits .= sprintf( __( 'Theme: %1$s.', 'jetpack' ), function_exists( 'wp_get_theme' ) ? wp_get_theme()->Name : get_current_theme() ); | |
$credits = apply_filters( 'infinite_scroll_credit', $credits ); | |
?> | |
<div id="infinite-footer"> | |
<div class="container"> | |
<div class="blog-info"> | |
<a id="infinity-blog-title" href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"> | |
<?php bloginfo( 'name' ); ?> | |
</a> | |
</div> | |
<div class="blog-credits"> | |
<?php echo $credits; ?> | |
</div> | |
</div> | |
</div><!-- #infinite-footer --> | |
<?php | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Modify the footer credits for JetPack Inifite Scroll | |
**/ | |
add_filter('infinite_scroll_credit','lc_infinite_scroll_credit'); | |
function lc_infinite_scroll_credit(){ | |
$content = '<a href="/privacy-statement/" title="Privacy Statement">Privacy Statement</a>'; | |
return $content; | |
} | |
/** End JetPack **/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The Infinite Blog Footer | |
* | |
* @uses self::get_settings, self::set_last_post_time, self::archive_supports_infinity, __, wp_get_theme, get_current_theme, apply_filters, home_url, esc_attr, get_bloginfo, bloginfo | |
* @return string or null | |
*/ | |
function footer() { | |
// Bail if theme requested footer not show | |
if ( false == self::get_settings()->footer ) | |
return; | |
// Bail if there are not enough posts for infinity. | |
if ( ! self::set_last_post_time() ) | |
return; | |
// We only need the new footer for the 'scroll' type | |
if ( 'scroll' != self::get_settings()->type || ! self::archive_supports_infinity() ) | |
return; | |
$credits = '<a href="http://wordpress.org/" rel="generator">Proudly powered by WordPress</a> '; | |
$credits .= sprintf( __( 'Theme: %1$s.', 'jetpack' ), function_exists( 'wp_get_theme' ) ? wp_get_theme()->Name : get_current_theme() ); | |
$credits = apply_filters( 'infinite_scroll_credit', $credits ); | |
$home_link = sprintf( __( '<a id="infinity-blog-title" href="%1$s" title="%2$s" rel="home">%2$s</a>', 'jetpack' ), get_home_url(), get_bloginfo( 'name' ) ); | |
$home_link = apply_filters( 'infinite_scroll_home_link', $home_link ); | |
?> | |
<div id="infinite-footer"> | |
<div class="container"> | |
<div class="blog-info"> | |
<?php echo $home_link; ?> | |
</div> | |
<div class="blog-credits"> | |
<?php echo $credits; ?> | |
</div> | |
</div> | |
</div><!-- #infinite-footer --> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment