Sorry for wasting your time reading my question but fortunately i have found where the problem is and i should have wrapped the title with !is_admin
if(!is_admin()){;
$title="<span style="background-color:#333333; padding:3px; color:#ffffff; border-radius: 4px;">".$greatgrandparent[0].':</span> '.$title;
}
I thought to delet the question but it my be handy for any one.
Thank you.