This topic contains 0 replies, has 4 voices, and was last updated by Anonymous 9 years, 3 months ago.
October 12, 2011 at 15:41 #2984
I believe if you add a language tag to the arg variable (like in the page of posts template http://codex.wordpress.org/Pages )
$args = array(
'cat' => $catid,
'paged' => $paged,
'order' => $order,
'ignore_sticky_posts' => $do_not_show_stickies,
'lang' => the_curlang()
You should be able to make it come up with a blank category if there is nothing there for the language…not sure though.
So the tag ‘lang’ => the_curlang() is what you want (where cur Lang is the current language).
Hope that helps,
NathanOctober 12, 2011 at 15:57 #2985
Thank you for your answer sungkhum.
Unfortunately it is not working. the_curlang() works fine obviously but I don’t think it is possible to use such ‘lang’ argument within wp_list_categories.
Am I wrong ?October 12, 2011 at 16:51 #2986
I didn’t test it, but are you sure you can’t? Look here http://codex.wordpress.org/Template_Tags/wp_list_categories
You should be able to pass the language variable…
Not positive though.
-NathanOctober 12, 2011 at 16:58 #2987
Your case is not very current.
wp_list_categories is a transverse list (taxonomy) in multilingual context because as you observe (or see inside source) continue to create link (and title) adapted to the current language ( and when clicked, fires a query to select posts in a language AND in a category)… wp_list_pages works on pages but not on taxonomies like wp_list_categories..
I will try if it possible to find a hook to adapt the count of each category when language sub-select is active… no garanties … just the time to dive in wp code
Be patientOctober 12, 2011 at 17:39 #2988
I tried your solution and it doesn’t seem to work. In my opinion it is logical because if I click on Cat1, there is no post (because I am on the French side). So the language parameter is already taken into account, but yet, Cat1 is displayed on the list.
I agree that my case is not a common one
And now I am asking myself if I am seeing things the wrong way… Another solution woull be to print out posts with default language when the translation is not available. It will solve my first problem and improve the website but I don’t really know how to do it. I have to look at the query…
So, no solution for the time being but I thank you both for your messagesOctober 13, 2011 at 7:13 #2989
remember that counter in taxonomies is updated when a post (or custom post) is attached to a term (a category) of the taxonomy. When buiding wp_categories_list, a « walker » check – according settings and count – if a line must displayed or not…
In multilingual context on a standalone db as in current wp install, this count is a little faulty if targeted for one language. The question is : must we create a special api for very rare situation to maintain a counter for each language.
Another approach for professional commercial high level website is to use xili-language premium on a wp network install as described here… but it is yet not free… https://dev.xiligroup.com/?p=1961
dev.xiligroup authorOctober 13, 2011 at 12:45 #2990
Thanks for this explanation. I am not sure xili-language premium will provide better features for me, since I believe I can use the fact that both languages are in the same db.
Maybe the best idea in my case is to show the available post with default language when no translation is available. This I don’t know how to do it yet, but I am currently looking into it.
You must be logged in to reply to this topic.