Opened 8 years ago
Last modified 6 years ago
#38935 new enhancement
Proposition to add the theme mod name as a param to the dynamic theme_mod_{$name} filters
Reported by: | nikeo | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
Description
Hi !
It would be convenient to be able to target a specific theme mod name when applying the same callback to all theme mods with add_filter( "theme_mod_{$name}", '_my_generic_callback' )
.
Right now we need to extract the theme mod with a code looking like this :
<?php function _my_generic_callback( $theme_mod_value ) { //extract theme mod name $_filter = current_filter(); $_ptrn = 'theme_mod_'; if ( $_ptrn !== substr( $_filter, 0, strlen($_ptrn) ) ) return $theme_mod_value; $_mod_name = str_replace($_ptrn, '', $_filter); //do things now // ... }
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
add the theme mod name to the dynamic theme_mod_{$name} filters