First and foremost: How can an electric fence stop pigs if pigs are able to go right through the wires, which,  unlike a hog wire fence which physically blocks the animals from going through the fence? Well, this video shows how. Watch and see that it is the electricity, not the physical fence that stops the animals. The animals don’t know what hit them! This is how an electric fence works:

The other video you need to watch explains how an electric fence works: