Please kindly check this msg.
First copy the masonry layout to your theme. You can follow topic 7 here http://www.masonrylayout.com/documentations/
Once the copy is done, you will get the location of new path. Please go to there and open layout.php. There you can place the code you have.