Created
September 1, 2021 16:57
-
-
Save milindmore22/3321c5eb54c9bf2f8c2121084d0c5f8c to your computer and use it in GitHub Desktop.
Code Snippets for AMP infinite Scroll plugin
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
<?php | |
/** | |
* Install the AMP Infinite Scroll Plugin and use the code snippet for your active theme. | |
* @link https://github.com/milindmore22/amp-infinite-scroll | |
*/ | |
/** | |
* Twenty Twenty One | |
*/ | |
add_filter( | |
'amp_infinite_scroll_configs', | |
function( $config ) { | |
$config = array( | |
'footer' => array( 'site-footer' => 'footer' ), | |
'next_page_hide' => array( | |
'widget-area' => 'aside', | |
'pagination' => 'nav', | |
'site-header' => 'header', | |
), | |
); | |
return $config; | |
} | |
); | |
/** | |
* Twenty Twenty | |
*/ | |
add_filter( | |
'amp_infinite_scroll_configs', | |
function( $config ) { | |
$config = array( | |
'footer' => array( 'header-footer-group' => 'footer' ), | |
'next_page_hide' => array( | |
'header-footer-group' => 'header', | |
'pagination-wrapper' => 'div', | |
'footer-nav-widgets-wrapper' => 'div', | |
), | |
); | |
return $config; | |
} | |
); | |
/** | |
* Twenty Nineteen | |
*/ | |
add_filter( | |
'amp_infinite_scroll_configs', | |
function( $config ) { | |
$config = array( | |
'footer' => array( 'site-footer' => 'footer' ), | |
'next_page_hide' => array( | |
'site-header' => 'header', | |
'widget-area' => 'aside', | |
'pagination' => 'nav', | |
), | |
); | |
return $config; | |
} | |
); | |
/** | |
* Astra. | |
*/ | |
add_filter( | |
'amp_infinite_scroll_configs', | |
function( $config ) { | |
$config = array( | |
'footer' => array( 'site-footer' => 'footer' ), | |
'next_page_hide' => array( | |
'site-header' => 'header', | |
'widget-area' => 'div', | |
'ast-pagination' => 'div', | |
), | |
); | |
return $config; | |
} | |
); | |
/** | |
* Neve. | |
*/ | |
add_filter( | |
'amp_infinite_scroll_configs', | |
function( $config ) { | |
$config = array( | |
'footer' => array( 'site-footer' => 'footer' ), | |
'next_page_hide' => array( | |
'header' => 'header', | |
'page-numbers' => 'ul', | |
), | |
); | |
return $config; | |
} | |
); | |
/** | |
* Generatepress Default header layout | |
*/ | |
add_filter( | |
'amp_infinite_scroll_configs', | |
function( $config ) { | |
$config = array( | |
'footer' => array( 'site-footer' => 'div' ), | |
'next_page_hide' => array( | |
'site-header' => 'header', | |
'paging-navigation' => 'nav', | |
'is-right-sidebar' => 'div', | |
), | |
); | |
return $config; | |
} | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment