Hybrid Core Context
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();
Available contexts
Since the context changes on each page, you’ll need a general guide on what contexts are available.
- Front Page
home
- Blog page (“posts page” from Settings > Reading)
blog
- Singular post (any post type) pages
singular
singular-{$post_type}
singular-{$post_type}-{$post->ID}
- Archive pages
archive
- Post type archives
archive-{$post_type}
- User/Author archives
user
user-{$user_nicename}
- Taxonomy archives
taxonomy
taxonomy-{$taxonomy}
taxonomy-{$taxonomy}-{$term->slug}
- Time/Date archives
date
year
month
week
day
time
hour
minute
- Search results
search
- Error pages
error-404