Shortcode
[cfgeo_flag]
This shortcode displays a responsive SVG or HTML flag based on the current visitor’s country.
Parameters
- size – (text) – Sets the size of the flag image. Example:
32px
- type – (1 or 0, default: 0) – Defines the image shape (only for SVG):
- 1 – Square
- 0 – Rectangle (default)
- country – (ISO country code) – Displays the flag of a specific country
- id – Sets the
id
attribute on the HTML element - class – Adds one or more CSS classes to the element
- css – Adds inline CSS styling to the flag element
- img – If present, returns an HTML
<img>
tag instead of SVG output (no value required) - exclude – (comma-separated values) – Hides the flag if the visitor is from a specified continent, country, region, or city
- include – (comma-separated values) – Shows the flag only for specified locations (others won’t see it)
Return
Displays the visitor’s country flag:
Note: If the flag is not visible, your VPN or proxy might be interfering with location detection.
Examples
Default usage:
[cfgeo_flag]
Change flag size:
[cfgeo_flag size=16px] [cfgeo_flag size=24px] [cfgeo_flag size=32px] [cfgeo_flag size=64px]
Show specific country flags:
[cfgeo_flag size=24px country="us"] [cfgeo_flag size=24px country="de"] [cfgeo_flag size=24px country="gb"] [cfgeo_flag size=24px country="rs"]
Advanced usage:
[cfgeo_flag id="my-image"] [cfgeo_flag id="my-image" class="img-round"] [cfgeo_flag id="my-image" class="img-round img-responsive" css="margin-top:10px; display:block;" img] [cfgeo_flag exclude="hu"] [cfgeo_flag include="at"]