if( ! function_exists( "is_ancestor" ) )
{
function is_ancestor( $ancestor = '' )
{
global $post, $wp_query, $wpdb;
if ( ! isset( $wp_query ) )
{
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
return false;
}
$ancestors = get_post_ancestors( $post->ID );
$where = $wpdb->prepare( "`post_title` = '%s' OR `post_name` = '%s'", $ancestor, $ancestor );