Custom post type loop error: Trying to get property of non-object

Hey this may be a little too late however I had this same issue on my custom made theme.

Firstly it turned out I didn’t create any custom posts and secondly, with the loop, because there were no posts I didn’t have the content-none file in my theme.

Once this was added the get_template_part( ‘content-parts/content’, ‘none’ ); code the error was gone.

Hope this helps someone else 🙂