I am having problems modifying the code for the Category Visability plugin so that it displays subcategories correctly. I used the following snippet, but keep getting an error.
This is the snippet:
Have found a fix for my problem, a bit clunky perhaps, but it works for 2 levels of subcategories, At line 322, change the part of the for each statement as follows:
foreach ($linklist as $link) {
if(preg_match("/class.children/”, $link)) {
$children = 1;
$newlist .= $link;
} elseif(preg_match(”/class.children/”, $link) && ($children=1)) {
$children = 2;
$newlist .= $link;
} elseif(preg_match(”/</ul>/”, $link) && ($children=1)) {
$children = 0;
$newlist .= $link;
} elseif(preg_match(”/</ul>/”, $link) && ($children=2)) {
$children = 1;
$newlist .= $link;
} else { ….. (ETC)
This is the error:
Parse error: parse error, unexpected T_CLASS in D:\Domains\go.id.au\wwwroot\wp-content\plugins\category_vis-rh.php on line 339
Line 339 is
} elseif(preg_match(”/class.children/”, $link) && ($children=1)) {
Any suggestions as to what I need to edit to make this work?