I am taking over a site and we are making a sister site to it, but the problem is that the navigation was set up for the other site - so I'm having an issue getting the navigation to link to the pages. What it is doing is using a filter of some sort... so when I try to click a link on the nav bar nothing happens but an empty drop down menu displays. We have no need for child pages on this project so I need help figuring out how to edit the filter so that parent pages act as links rather than "menu titles" if you will.
here's my code:
<?php
//add_filter ('wp_list_pages', 'formatNavList');
$myPages = wp_list_pages(array('title_li' =>'', 'depth' =>1, 'sort_column' => 'menu_order, post_title', 'echo' =>0, ));
$templateDir = get_bloginfo("template_directory");
$pattern1 = "/<li.*?>.*?<a.*?>(.*?)<\/a>/is";
$replString1 = "<li class='navButton' >$1
<div class='dropdown1Col' >
<img class='dropdown1ColTop' src='$templateDir/images/bgGraphics/DropDownNav_1ColTop_200x30.png' />
<div>
<img class='dropdown1ColMid' src='$templateDir/images/bgGraphics/DropDownNav_1ColMid_Stretch.png' />";
$pattern2 = "/(<\/li>\s*?<li[^>]*navButton.*?>)/is";
$replString2 = " <p class='clearFloat' />
</div>
<img class='dropdown1ColBtm' src='$templateDir/images/bgGraphics/DropDownNav_1ColBtm_200x30.png' />
</div>$1";
$pattern3 = "/(<\/li>\s*?)$/is";
$replString3 = " <p class='clearFloat' />
</div>
<img class='dropdown1ColBtm' src='$templateDir/images/bgGraphics/DropDownNav_1ColBtm_200x30.png' />
</div>";
$menu = explode('<li ', $myPages);
$sub = 0;
$i = 0;
$id = array();
foreach ($menu as $key => $val) {
$match = $matches = 0;
if ($sub == 0){
$id[] = $key;
$pos = strpos($val,'<a');
$text = preg_replace($pattern1, $replString1, "<li alt='$sub' $val");
$output .= $text;
}else{
$output .= "<li alt='$sub' $val";
}
if (preg_match_all("/(<ul class='children'>)/",$val,$match,PREG_PATTERN_ORDER)){
$sub = $sub + count($match[0]);
}else if (preg_match_all("/(<\/ul>)/",$val,$matches,PREG_PATTERN_ORDER)){
$sub = $sub - count($matches[0]);
};
$i++;
if($i==3){$i=0;};
}
$output = preg_replace($pattern2, $replString2, $output);
$output = preg_replace($pattern3, $replString3, $output);
echo $output;
?>
any help would be greatly appreciated! Thank you in advance!