Viewing 2 replies - 1 through 2 (of 2 total)
  • michaelbcrea

    (@michaelbcrea)

    Hi

    Did you find a solution?

    I have the same problem…

    Thank you very much!

    hi,

    i had the same problem but i’ve thought about possible solution, maybe it’s not the best but it’s working…

    i wanted to get only the country but i didn’t want to touch the plugin code so in my function.php file i’ve created this:

    function getCountry(){
        $quick_flag = do_shortcode('[quick-flag]');
        $country = substr($quick_flag, 0, strpos($quick_flag, '('));
        $country = str_replace(' ','', $country);
        echo $country;
    }

    the function is trimming everything in the output string from ‘(‘ (the flag and the brackets), remove spaces and echo the country so all we need to do now is call it where we like to.

    if you’r looking for a shortcode to use in the admin panel so we can add new shortcode:

    function new_quick_flag() {
    	$quick_flag = do_shortcode('[quick-flag]');
    	$country = substr($quick_flag, 0, strpos($quick_flag, '('));
    	$country = str_replace(' ','', $country);
    	return $country;
    }
    add_shortcode( 'quick-country', 'new_quick_flag' );

    put [quick-country] where you like to.

    hope this helped,
    eran

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove parentheses around the flags’ is closed to new replies.