Remove link on parent with child in site map?

I would like to remove the link to the parent if it has a child, while still keeping the links to the children. I believe this is the section of code to modify, but so far my attempts have only resulted in errors…

function five_print_ancestors_with_child(){
//get ancestors
$result = five_get_ancestors();
if($result){
//loop result from above database query and list child pages of ancestors
foreach ($result as $res){
//prepare ancestor id for wp_list_pages
$ancestor_id = $res->ID;
//get all child and grand child of ancestor page
$children = wp_list_pages(“title_li=&child_of=$ancestor_id&echo=0”);
//if there is children
if($children){
echo ‘

’;
//this is the ancestors
echo “$res->post_title
    ”;
    //this is the children
    echo $children;
    echo ‘
’;

I think you need to modify this code:
[php]//this is the ancestors
echo “$res->post_title

    ”;[/php]

    making it look like this:
    [php]//this is the ancestors
    echo $res->post_title."

      ";[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service