Theme Levitation (Pagination) Plugin qTranslate – a possible solution
-
We use the theme (Levitation 1.3.1 by Kriesi) containing a pagination function. We implemented the qTranslate Plugin to have more languages. We chose the option to transfer language info by jQuery (for example: ?lang=en).
But then we find out, that Pagination doesn’t work, because it’s not transferring the jQuery datas.
Solution
Open in the theme sub-folder “options” the file “paginations.php”
Find the code
else { $pages = 1; }
After this fill in the following code
/* GET THE URL OF THE ACTUALLY PAGE */ /* $url = get_permalink( $post->ID ); */ $url = $_SERVER['REQUEST_URI']; /* CHECK THE LANGUAGES OF THE URL */ $str = $url; /* CHECK IF URL CONTAINS LANG-DE */ if (eregi('\?lang=de', $str)) { $lang = 'de'; } /* CHECK IF URL CONTAINS LANG-EN */ elseif (eregi('\?lang=en', $str)) { $lang = 'en'; } /* CHECK IF URL CONTAINS LANG-ES */ elseif (eregi('\?lang=es', $str)) { $lang = 'es'; } else { $lang = 'en'; }
Now find
if(1 != $pages){ echo "<div class='pagination'>"; echo ($paged > 2 && $paged > $range+1 && $showitems < $pages)? "<a href='".get_pagenum_link(1)."'>«</a>":""; echo ($paged > 1 && $showitems < $pages)? "<a href='".get_pagenum_link($prev)."'>‹</a>":""; for ($i=1; $i <= $pages; $i++){ if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){ echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>"; } } echo ($paged < $pages && $showitems < $pages) ? "<a href='".get_pagenum_link($next)."'>›</a>" :""; echo ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) ? "<a href='".get_pagenum_link($pages)."'>»</a>":""; echo "</div>\n"; } } ?>
and replace it with
if(1 != $pages){ echo "<div class='pagination'>"; echo ($paged > 2 && $paged > $range+1 && $showitems < $pages)? "<a href='".get_pagenum_link(1)."'>«</a>":""; echo ($paged > 1 && $showitems < $pages)? "<a href='".get_pagenum_link($prev)."'>‹</a>":""; for ($i=1; $i <= $pages; $i++){ if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){ echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i) ."' class='inactive' >".$i."</a>"; } } echo ($paged < $pages && $showitems < $pages) ? "<a href='".get_pagenum_link($next)."'>›</a>" :""; echo ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) ? "<a href='".get_pagenum_link($pages)."'>»</a>":""; echo "</div>\n"; } } ?>
This should work now. Maybe it’s useful for other Pagination Plugins too.
- The topic ‘Theme Levitation (Pagination) Plugin qTranslate – a possible solution’ is closed to new replies.