2013-11-08, 22:16:57
(This post was last modified: 2013-11-08, 23:30:54 by moonspider.)
Hi everyone!
I need a help with this great plugin.
I have a set of pages with numeric slugs like 1, 2, 3 etc. Each has a duplicate in a different language, e.g 1_lng, 2_lng, etc. All of them tagged as 'story'.
So I'm trying to add a custom code in my template's sidebar to show the latest 15 pages of this tag and their creation date.
Here's the code:
It shows a list of english pages if language is set to english (which is default), but if it's the other language it shows all pages from both languages. What should be added to this code to alter results by current language?
Oh, and also, is there a way to specify how to sort results? Like, if I needed to sort them by title on a separate page.
I need a help with this great plugin.
I have a set of pages with numeric slugs like 1, 2, 3 etc. Each has a duplicate in a different language, e.g 1_lng, 2_lng, etc. All of them tagged as 'story'.
So I'm trying to add a custom code in my template's sidebar to show the latest 15 pages of this tag and their creation date.
Here's the code:
PHP Code:
$listnum = 0;
$sidelists = return_i18n_search_results('story');
foreach ($sidelists['results'] as $sidelist) {
if ($listnum==15) break;
echo strftime("%Y/%m/%d", $sidelist->creDate), " - <a href=\"", $sidelist->url, "\">", $sidelist->title, "</a><br />";
$listnum++;
if ($listnum == 15) {
echo "<h3><a href=\"", get_site_url(), "news\">More news</a></h3>";
} }
It shows a list of english pages if language is set to english (which is default), but if it's the other language it shows all pages from both languages. What should be added to this code to alter results by current language?
Oh, and also, is there a way to specify how to sort results? Like, if I needed to sort them by title on a separate page.