Hi guys,
I am trying to create some custom navigation for a site, where categories are displayed only within the current "family". I have the call to list the pages working fine:
<?php wp_list_categories('child_of=112&title_li=') ?>
I also found some code within this forum that works perfectly to conditionally display only on related pages(in this instance my top level category is id=112):
<?php
if ( is_category() ) {
$cat = get_query_var('cat');
$args = array(
'include' => $cat,
'hide_empty' => 0
);
$categories = get_categories($args);
if ( ($cat == 112) || ($categories[0]->category_parent == 112) ) {
}
}
?>
I've tested both components and they work great separately, but as soon as I try to combine them the pages fails to load. Here is what I have:
<?php
if ( is_category() ) {
$cat = get_query_var('cat');
$args = array(
'include' => $cat,
'hide_empty' => 0
);
$categories = get_categories($args);
if ( ($cat == 112) || ($categories[0]->category_parent == 112) ) {
<?php wp_list_categories('child_of=112&title_li=') ?>
}
}
?>
My understanding of php is rudimentary at best and I'm guessing that this will be a simple syntactic issue. If anyone could offer advice, It would be greatly appreciated.