Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    sorry this is not available at the moment and you need custom coding to make this work – http://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/ (replace event with location)

    Thread Starter torpedo_booking

    (@torpedo_booking)

    Thank you so much.
    I am not too afraid of custom coding, trial and error usually works (after hours and some support :p ) but it would be a very nice feature to have (at least to be able to choose). Maybe you might concider taking this into a future release.

    I agree with torpedo_booking, this would be a great placeholder to add to the plugin.

    Hello, any news on this? I’d like to show a country flag, with the name as <countrycode>.png, so a #_LOCATIONCOUNTRYCODE tag would be very handy.

    Finally managed to find some time to tackle this problem.

    Used the following code in functions.php to use a #_COUNTRYCODE placeholder and have it replace by a country flag.

    /* Add events manager placeholder for country code and output flag image */
    add_filter( 'em_event_output_placeholder', 'nstrm_country_code_placeholder', 1, 3 );
    function nstrm_country_code_placeholder( $replacement, $EM_Event, $result ) {
    	global $wp_query, $wp_rewrite;
    	switch ( $result ) {
    		case '#_COUNTRYCODE':
    			$location     = em_get_location( $EM_Event->location_id );
    			$country_code = $location->location_country;
    			if ( '' != $country_code ) {
    				// generate flag url
    				$country_img  = get_stylesheet_directory_uri() . "/images/flags/" . strtolower( $country_code . ".png" );
    				$country_html = '<span class="flag-wrap"><img class="flag" src="' . $country_img . '" /></span>';
    			}
    			$replacement = $country_html;
    			break;
    	}
    
    	return $replacement;
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Country / Countrycode (ISO)’ is closed to new replies.