Created
July 29, 2014 20:29
-
-
Save joshfeck/e7ad286a897ebeec86a3 to your computer and use it in GitHub Desktop.
Event Espresso 4 Venue location address abbreviation filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
// example function to add to your custom function plugin or file follows | |
function custom_espresso_address_region( $original, $obj_with_address) { | |
return $obj_with_address->state_obj() instanceof EE_State ? | |
'<span itemprop="addressRegion">' . $obj_with_address->state_obj()->name() . '</span>': | |
''; | |
} | |
add_filter('FHEE__EEH_Formatter_address_region_format','custom_espresso_address_region',10,2); | |
// future version of Event Espresso 4 will include the proposed following change that adds the filter: | |
/** | |
* addressRegion | |
* The region (state, province, etc). For example, CA. | |
* | |
* @access public | |
* @param object $obj_with_address | |
* @return string | |
*/ | |
public static function addressRegion ( $obj_with_address = NULL ) { | |
return $obj_with_address->state_obj() instanceof EE_State ? apply_filters('FHEE__EEH_Formatter_address_region_format','' . $obj_with_address->state_obj()->abbrev() . '' , $obj_with_address): ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment