Rather than try to explain how to apply an eartag, here’s a video of me doing it. Any questions?
As for the legalities here in the UK, you don’t have to tag your pigs if they’re under 12 months, unless you’re going to move them to an abattoir, market or anywhere else that isn’t a farm or smallholding. I tag mine about a week before taking them for slaughter.
The relevant, up-to-date info can be found on the DEFRA website here: https://www.gov.uk/pig-keepers-identify-animals-before-moving-them