Site logo

[Support request] Load more button on AMP

Home Forums Support [Support request] Load more button on AMP

Home Forums Support Load more button on AMP

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1541336
    ETO

    The load more button does not work on AMP pages.

    #1541900
    David
    Staff
    Customer Support

    Hi there,

    Load More requires Javascript – and AMP pages do not allow Javascript.
    You could try adding this PHP Snippet to disable the Load more on AMP Pages:

    add_filter( 'option_generate_blog_settings', 'db_disable_infinite_scroll_amp' );
    function db_disable_infinite_scroll_amp( $options ) {
        if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
            $options['infinite_scroll'] = false;
    	    $options['infinite_scroll_button'] = false;
        }
        return $options;
    }

    More info on the filter:
    https://docs.generatepress.com/article/option_generate_blog_settings/

    #1542763
    ETO

    Can I add this PHP code using elements > hook ?

    #1542992
    Elvin
    Staff
    Customer Support

    Hi,

    Can I add this PHP code using elements > hook ?

    It isn’t recommended as it can cause issues.

    This should ideally be added to a Child theme’s functions.php or by using plugins like Code Snippet plugin. – https://docs.generatepress.com/article/adding-php/

    #1545045
    ETO

    Thank you so much! I added the code and it hides the load more button. But, there appears pagination instead of load more button.

    Could you please give me the necessary code to hide the pagination on these page on AMP pages?

    #1546842
    Tom
    Lead Developer
    Lead Developer

    Just to confirm, you’re wanting to remove pagination completely on AMP?

    #1546884
    ETO

    Yes, I want to remove them as they do not appear on normal pages. I do not want them to be indexed by Google.

    #1547650
    Tom
    Lead Developer
    Lead Developer

    You could try this:

    add_action( 'wp_head', function() {
        if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
            echo '<style>.paging-navigation {display: none;}</style>';
        }
    } );
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.