13:10 Jesus said to him, "One who has bathed does not need to wash, except for the feet, but is entirely clean. And you are clean, though not all of you."
13:11 For he knew who was to betray him; for this reason he said, "Not all of you are clean."
13:12 After he had washed their feet, had put on his robe, and had returned to the table, he said to them, "Do you know what I have done to you?
13:13 You call me Teacher and Lord--and you are right, for that is what I am.
13:14 So if I, your Lord and Teacher, have washed your feet, you also ought to wash one another's feet.
13:15 For I have set you an example, that you also should do as I have done to you.
Both before, and after.
Compare it to Luke 7:36-50. There is an interesting tale of transmission here. The Synoptics and John don't share are many stories as we might imagine, but the anointing is one of them. For Mark and Matthew, that anointing takes place just before Jesus retires to the Garden of Gethsemane. Luke relocates it to the beginning of Jesus' public ministry away from the Pharisees (it is their last lesson, for awhile, in who is called to the basiliea tou theou). John's story takes place almost entirely from the time Jesus enters Jerusalem for the last time (the cleansing of temple occurs right after the wedding in Cana). John includes the anointing story after Jesus raises Lazarus from the dead (which is only in John), and has it performed by Mary, while Martha serves; an echo of a similar story in Luke.
The other echo is here. Luke moved the anointing from the head to the feet. John keeps that alteration in chapter 12, and repeats the gesture in chapter 13. Luke's story clearly involves a prostitute (women in the company of men, even a wife, would be shamed as a whore in Jesus' time; his inclusion of women, and their willingness to be included, is more radical than we realize) and solicitation (her actions are straight from 1st century Greek erotic literature). Jesus' actions clearly accept her, even though she is a "sinner" (the point of the story). John's gospel includes no "last supper," but only this tale of foot-washing. It is the sacrament-that-wasn't, though it gives rise to the name for this day, "Maundy" being an older English word meaning "command." But when Jesus says "love one another--as I have loved you, so you are to love one another," Jesus doesn't say "except for traitors like Judas." And Jesus doesn't say "you should do as I have done for you, except for Judas." And John underlines that, by pointing out Jesus knew what Judas would do, but at no point does Jesus exclude Judas from the circle.
Neither before, nor after.