Get post type from taxonomy or category page

get_queried_object() is your friend. It will tell you all kinds of information about what your template files are trying to do. From within, you can discover your post type. Try doing a var_dump to take a look at that object.

As for your second question, taxonomy is not, as far as I know, isolated to one post_type, so that is not really something one can assume. For example, “location” may be a taxonomy to both post types: “Restaurants” and “Grocery Stores”.

error code: 523