[Support request] Translating Page Navigation

Home Forums Support [Support request] Translating Page Navigation

Home Forums Support Translating Page Navigation

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2288366
    John

    Hi,

    Re: https://www.origamispirit.com/es/page/2/

    Site translated with WPML.

    At the bottom of the page is pagination delivered with the snippet:

    add_action('wp',function(){
    	remove_action( 'generate_after_loop', 'generate_do_post_navigation' );	
    });
    
    add_action( 'generate_after_loop', function() {	
        echo '<div class="paging-navigation">';
        posts_nav_link( ' ', '<<< PREVIOUS ', ' NEXT >>>' );
        echo '</div>';
    
    });

    PREVIOUS and NEXT are not being translated even though I’ve customized the string in WPLM. I’ve also cleared server/browser caches but no change.

    Any ideas?

    Thanks!

    John

    #2288441
    David
    Staff
    Customer Support

    Hi there,

    not sure on that, WPML may be able to advise.

    But why not use the default post paging nav ?
    You can filter the default text here:

    https://generatepress.com/forums/topic/blog-post-navigation-translating-or-omitting-next-previous/#post-1498199

    #2289479
    John

    Hi David,

    WPML did advise and changed the snippet to the following. WPML was then able to translate these strings. I don’t know why I didn’t do as you suggested above originally, and I can’t find in any of my topics where I found the pagination snippet.

    add_action('wp',function(){
    	remove_action( 'generate_after_loop', 'generate_do_post_navigation' );	
    });
    
    add_action( 'generate_after_loop', function() {	
        echo '<div class="paging-navigation">';
    	$previous = _( '<<< PREVIOUS ', 'my-text-domain' );
    	$next = _( ' NEXT >>>', 'my-text-domain' );
    	
        posts_nav_link(' ',$previous,$next);
    	
        echo '</div>';
    
    });
    #2289497
    David
    Staff
    Customer Support

    That makes sense – glad to see you got a working solution and thanks for sharing that here!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.