Alignment of a compass needle From what I know, the compass needle aligns itself with the earth's magnetic field since Earth's geographic north pole(magnetic south) attracts the compass needle's north pole.
However, when a compass is placed near a current carrying wire, how does it aligns itself in the direction of the wire's magnetic field even though there is no north or south pole to attract the tips of the compass needle?
 A: You shouldn't think about it as being attracted towards one of the poles, but rather the needle aligns itself with the magnetic field lines.  A magnet generates field lines that look like the following:

The field lines from the magnet extend throughout all space, which is how we are able to detect them on the surface of the earth.  What your compass needle is doing is aligning itself with the arrows in the diagram above, which tells you in what direction the field points at that location, which also implies in what direction the south pole of the magnet is.
Magnetic fields are also generated by current carrying wires.  To understand why moving charges (currents) create a magnetic field, see this answer: How do moving charges produce magnetic fields?.  Up close, these fields can be stronger than that of the earth, and therefore the needle will align it self with the net field near the wire.
A: This is a property of a magnet: A force that pulls on other ferromagnetic materials, such as iron and attracts or repels other magnets. A permanent magnet is an object made from a material that is magnetized and creates its own persistent magnetic field.
