Basic code clean up and debug squashes 

With WP_DEBUG enabled, there were some PHP notices & warnings I cleaned up a bit.  Also fixed one missing `</span>` closing tag in content-reference.php