The deceased person had made a will that his funeral Ṣalāĥ should be led by so-and-so Imām or so-and-so would give him the ritual bath. This will is Bāṭil, i.e., this will is not going to waive the right of his Walī (the guardian of the deceased person). Indeed, the guardian has the authority not to lead the funeral Ṣalāĥ himself as Imām and allow the designated person to lead the funeral Ṣalāĥ. (Baĥār-e-Sharī’at, vol. 1, pp. 837; ‘Ālamgīrī, vol. 1 pp. 163, etc.) If the will is for a pious person or an Islamic scholar, the heirs should then act upon it.
It is Mustaḥab (preferable) for the Imām to stand in front of the chest of the corpse; he should not be far whether the corpse is of a male or a female, an adult or a minor. This is valid when there is only one corpse for the funeral Ṣalāĥ and if there are more than one, then the Imām should stand near in front of the chest of one corpse. (Durr-e-Mukhtār, Rad-dul-Muḥtār, vol. 3, pp. 134)
If the dead body is buried and even the handful of earth is thrown, now the funeral Ṣalāĥ should be offered in front of his/her grave till the dead body is not likely to be decayed, if