Immediately upon entering the Simian Throne Room, you'll see an Earth Elemental Gate to your right. Use an Earth Skylander to open the path, then proceed forward to the block puzzle. While avoiding the spears, push block A forward, then left. Once it's in place, push block B forward and block C twice to the right. Hop across the blocks to reach the next area.
In here, push block A forward, then push block B forward, right, and forward twice. Proceed through the rest of the area to reach your prize.
When you land in Impenetrable Fort after destroying the first airship, you'll be near a dual Air/Tech Elemental Gate. Use a Swap Force character with these elements (or two appropriate Skylanders, if you're playing co-op) to open it. Complete the shifting course inside to obtain this.
You'll find this after Baron Von Shellshock blows up the bridge. Hop onto the first ledge from the mine cart and look left to spot a Fire Elemental Gate. Use a Fire Skylander to open the gate, and complete the course inside to earn this hat.