Added variable substitution to newpost function.