简体   繁体   中英

How to display sub categories using Collapsing Categories plugin

My site is using the Collapsing Categories plugin (Robert Felty). As a sidebar widget, it is working the way we want it. But now I've written a page, and I'm inserting the php code in the page, and I don't know how to make it display the same Blog sub categories that it displays on any blog post page.

The sub-categories of the blog category are: - from-the-experts - grilling-lifestyle - grilling-tips-and-techniques

But when I add the php code to the page (using the page editor), it outputs all the top level categories, instead: ►Blog (118)

►Lamb (1)

►News (1)

►Recipes (59)

►Uncategorized (4)

This is the php code, taken from the readme.txt page:

[php]
echo "<ul class='collapsCatList'>\n";
if (function_exists('collapsCat')) {
    collapsCat();
} else {
    wp_get_categories('your_options_here');
}
echo "</ul>\n";
[/php]

What I want to know is what I have to put in that code to display only the few sub categories I want displayed.

Answered by plugin author here

$my_options=array(
   'inExclude' => 'include',
   'inExcludeCats' => 'blog',
  'showTopLevel' => false
);
echo "<ul class='collapsCatList'>\n";
if (function_exists('collapsCat')) {
    collapsCat($my_options);
} else {
    wp_get_categories('your_options_here');
}
echo "</ul>\n";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM