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();
//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
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


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

Sponsor our Newsletter | Privacy Policy | Terms of Service