سرویس ها


$ancestors = [];
            $root      = $parent = false;

            if ( $post->post_parent ) {
                $ancestors = get_post_ancestors( $post->ID );
                $root      = count( $ancestors ) - 1;
                $parent    = $ancestors[$root];
            } else {
                $parent = $post->ID;
            }
$ancestors = [];
            $root      = $parent = false;

            if ( $post->post_parent ) {
                $ancestors = get_post_ancestors( $post->ID );
                $root      = count( $ancestors ) - 1;
                $parent    = $ancestors[$root];
            } else {
                $parent = $post->ID;
            }