• I’m using qTranslate plugin to maintain several languages on my blog and I found out that WP-Paginate produces pagination links without ‘localized’ part. For example:
    Default language page 2 URL: https://some.site/page/2/
    English language page 2 URL should be: https://some.site/en/page/2/

    This is just an example, qTranslate could generate different form URLs for alternate languages, but this does not matter for WP-Paginate plugin, all author needs to do is to add following code at the end of wp-paginate.php:

    if(function_exists('qtrans_convertURL')) : add_filter('get_pagenum_link', 'qtrans_convertURL'); endif;

    If qTranslate is used then all the page links in alternate language will have proper localization part, if not – nothing will change.

    I’ve added this code to wp-paginate.php on my site and it works like a charm.

    https://www.ads-software.com/extend/plugins/wp-paginate/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m assuming that the qTranslate plugin already has a filter for get_pagenum_link, right?

    If so, since WP-Paginate uses get_pagenum_link, wouldn’t it already work as long as the qTranslate plugin was enabled?

    Thread Starter Mortus

    (@mortus)

    Eric, qTranslate has no such filter, unfortunately.

    Actually I didn’t know that get_pagenum_link() was WP function, thought it was your ?? Maybe it would be better to contact qTranslate’s author then, thanks for pointing out.

    You are correct, contacting the qTranslate author is the way to get this correctly supported.

    Otherwise every plugin that uses get_pagenum_link() would need to add the code you suggested ??

    I used the following to enable pagination support with qTranslate
    by using wp_link_pages ( ) function for 2 languages (Russian and English in this example)

    Modify ‘entry’ in page.php of your Theme:


    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

    <?php $lang = qtrans_getLanguage();
    if ($lang=="ru")
    wp_link_pages(array('before' => '<p>Страницы: ', 'pagelink' => '[ % ]', 'after' => '</p>', 'next_or_number' => 'number'));
    else if ($lang=="en")
    wp_link_pages(array('before' => '<p>Pages: ','pagelink' => '[ % ]', 'after' => '</p>', 'next_or_number' => 'number'));?>

    </div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP-Paginate] Pagination links with qTranslate’ is closed to new replies.