Archived topic
Custom"load more" button
3 replies · Started by Ginaphi on December 9, 2020
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.
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 :)
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;
} );
Awesome, looks good!