On every page view, Hybrid Core sets a context based on the page being viewed. This context is used within the framework’s
<body> class function and in things such as its atomic hooks. This can be extremely useful when needing to get the current page’s context.
The context is automatically set, so you don’t have to perform any actions to make this feature work.
Getting the context
If for some reason you need to get the current page’s context, you can use the
hybrid_get_context() function. It returns a PHP array of the contexts for the current page. It’s doubtful that you’ll ever need this function, but it’s available if you do.
$context = hybrid_get_context();
Since the context changes on each page, you’ll need a general guide on what contexts are available.
- Front Page
- Blog page (“posts page” from Settings > Reading)
- Singular post (any post type) pages
- Archive pages
- Post type archives
- User/Author archives
- Taxonomy archives
- Time/Date archives
- Search results
- Error pages