Error in php coding.
<link rel="canonical" href="<?php echo $_canonical;?>" />
should be
<link rel="canonical" href="<?php echo $_canonical; ?>" />
now canonical tags are hidden from front page and show up in header, also pass canonical test.
http://www.seoreviewtools.com/canonical-url-location-checker/