Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/e7ad286a897ebeec86a3 to your computer and use it in GitHub Desktop.
Save joshfeck/e7ad286a897ebeec86a3 to your computer and use it in GitHub Desktop.
Event Espresso 4 Venue location address abbreviation filter
<?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