Wordpress widget how to only display sub-categories based on selected Parent Category?

后端 未结 3 1154
抹茶落季
抹茶落季 2021-01-01 03:05

I was wondering if anybody know hows to modify the existing category widget to only display the categories within the selected parent category. Example:

If my catego

3条回答
  •  被撕碎了的回忆
    2021-01-01 03:28

    how about using something like this? on a singles page you could add a call from within the single.php page to a new sidebar or an include file...?

    ie:

    
    

    newsidebar.php

      cat_ID; wp_list_categories('orderby=id&child_of='.$myCat); ?>

    this will show only categories from the currently used category?

    ie:

    if current category is 5 // Computers then all that will be shown in the list is

    * Laptops
    * Desktops
    * Software
    

提交回复
热议问题