2013-03-08 100 views
0

去「mysite.com/category/my_city/restaurants/」我可以顯示所有屬於類別「my_city」和類別「餐廳」下的帖子。WordPress的:來自多個類別的兒童帖子

我們假設餐館類別有幾個孩子(泰語,意大利語等):我如何製作所有子類別的餐廳的子類別列表,這些子類別也是和僅在my_city類別下?

例如「mysite.com/category/my_city/thai/」

就目前而言,這是在我的category.php文件中的代碼:

<?php 
$this_cat = (get_query_var('cat')) ? get_query_var('cat') : 1; 
$this_category = get_category($this_cat); 
if ($this_category->parent) { $this_cat = $this_category->parent; } 
wp_list_categories('title_li=&child_of=' . $this_cat . ''); 
?> 

結果就像是一個列表「泰國,意大利等「(這顯然是好的),但鏈接都指向」mysite.com/category/restaurants/thai/「之類的東西,顯示所有餐廳,而不僅僅是my_city下的那些餐廳。 很明顯,我沒有捕捉到其他類別,也不知道如何做正確的數組。

非常感謝您的幫助。

回答

相關問題