/** * Adds contextual filter hooks to the theme. This allows users to easily filter context-based content * without having to know how to use WordPress conditional tags. The theme handles the logic. * * An example of a basic hook would be 'spyropress_entry_meta'. The spyropress_apply_atomic() function extends * that to give extra hooks such as 'spyropress_entry_meta_home', 'spyropress_entry_meta_singular' and 'spyropress_entry_meta_singular-page'. */ function spyropress_apply_atomic($tag = '', $value = '') { if (!$tag) { return false; } // Apply filters on the basic hook. $value = apply_filters($tag, $value); // Loop through context array and apply filters on a contextual scale. foreach ((array) spyropress_get_query_context() as $context) { $value = apply_filters("{$context}_{$tag}", $value); } // Return the final value once all filters have been applied. return $value; }
function spyropress_get_context() { return spyropress_get_query_context(); }