[Resolved] Custom”load more” button

Home Forums Support [Resolved] Custom”load more” button

Home Forums Support Custom”load more” button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1572765
    fredyciang

    Good day,
    im using polylang and im trying to customize the ajax “load more” button to have multilingual capability.
    i intended to use polylang scripts to register and modify gp code to it – (pll_register_string(‘pll_load_more’, ‘Load More’);

    https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/

    i cant seems to find gp scripts/php to be modified for it.

    #1573379
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The load more text is a setting in the Customizer – not sure if Polylang has an option to translate those directly?

    If not, you can filter the value like this:

    add_filter( 'option_generate_blog_settings', function( $settings ) {
        $settings['masonry_load_more'] = 'Your load more value';
        $settings['masonry_loading'] = 'Your loading text value';
    
        return $settings;
    } );

    Hope this helps 🙂

    #1574266
    fredyciang

    Thank you for the answer. this is what i try to do.

    // register custom word to polylang translation in admin
    add_action('init', function() {
      pll_register_string('pll_load_more', 'Load More');
      pll_register_string('pll_loading', 'Loading');
    });
    
    // infinite post load more ajax button to set as multilingual polylang
    add_filter( 'option_generate_blog_settings', function( $settings ) {
    	$settings['masonry_load_more'] = pll('Load More');
    	$settings['masonry_loading'] = pll('Loading');
    
    	return $settings;
    } );
    #1574696
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.