Check to see what you’re getting. The new WP_Query()
isn’t working for some reason. Do a var_dump
on it. I suspect that you aren’t getting any results from the query, resulting in a Trying to get property of non-object
when you try to access the methods.