[Plugin: Multi-column Tag Map] How to only display children of a category
-
Hi,
This is a fantastic plugin, but I have a large site that has a lot of categories and thought this would be a perfect way to get around them if I could display only the children of a category, so I have been tinkering to make it do this!!
The changes seem to work OK on my development server, but I am not sure if you want it to do this (or even the correct way to submit code as you can see!) or if anyone else wants to do the same thing, but the code changes are only small so I thought I would share and see if it was useful to anyone…
I altered the short code to use a “child_of” parameter
extract(shortcode_atts(array(
"columns" => "2",
"more" => "View More",
"hide" => "no",
"num_show" => "5",
"toggle" => "no",
"show_empty" => "no",
"name_divider" => "|",
"tag_count" => "no",
"exclude" => "",
"descriptions" => "no",
"width" => "",
"equal" => "no",
"manual" => "",
"basic" => "no",
"basic_heading" => "no",
"show_categories" => "no",
"child_of" => "0",
"taxonomy" => "",
"group_numbers" => "no",
"show_navigation" => "no",
), $atts));
and likewise
<dd>basic_heading => '.$basic_heading.'</dd>
<dd>show_categories => '.$show_categories.'</dd>
<dd>child_of => '.$child_of.'</dd>
<dd>taxonomy => '.$taxonomy.'</dd>and finally restrict the returned categories to those that are children of the category you set “child_of” to
} elseif($show_categories == "yes"){
$tags = get_categories('child_of='.$child_of.'&order=ASC&hide_empty='.$show_empty.'');
} else {So now if you set the show_categories to “yes” then you have the option of setting the “child_of” to the ID of the category you want the children of (it defaults to 0 so shows all if not set)
As I said I have just been tinkering to make it work for my own purposes so make no promises that it will work, but hope someone (other than me!) finds it useful
Matt
https://www.ads-software.com/extend/plugins/multi-column-tag-map/
- The topic ‘[Plugin: Multi-column Tag Map] How to only display children of a category’ is closed to new replies.