Add flags to widget
-
I am trying in these day the plugin and it is very nice! I hope you will be able to continue the development because it is really promising.
Anyway I would like to add a suggestion to consider for future releases, it would nice to have the possibility to have the country flag near the streamer name.
I did a small modification to the widget code, and I’ll post here if someone is interested. It works but I am not so good at PHP programming.
You need first to add flags sprites to your css, using a service like this one (https://flag-sprites.com/)
This is an example with few flags I am interested in.
/* flags */ .flag { width: 16px; height: 11px; background:url(flags.png) no-repeat } .flag.flag-au {background-position: -16px 0} .flag.flag-ca {background-position: -32px 0} .flag.flag-cn {background-position: -48px 0} .flag.flag-de {background-position: -64px 0} .flag.flag-dk {background-position: 0 -11px} .flag.flag-england {background-position: -16px -11px} .flag.flag-eu {background-position: -32px -11px} .flag.flag-fr {background-position: -48px -11px} .flag.flag-gb {background-position: -64px -11px} .flag.flag-it {background-position: 0 -22px} .flag.flag-ph {background-position: -16px -22px} .flag.flag-ru {background-position: -32px -22px} .flag.flag-scotland {background-position: -48px -22px} .flag.flag-se {background-position: -64px -22px} .flag.flag-sg {background-position: 0 -33px} .flag.flag-th {background-position: -16px -33px} .flag.flag-ua {background-position: -32px -33px} .flag.flag-us {background-position: -48px -33px}
Then you should modify the widget code inf file stream-status-widget.php
<span class="lsb-status-widget-title"> <strong><img src="<?php echo plugins_url( 'images/blank.gif' , __FILE__ ) ?>" class="<?php echo 'flag flag-' . $menu_item->attr_title ?>" alt="Country"></strong> <a href="<?php echo $menu_item->url; ?>" target="_blank"><?php echo apply_filters( 'lsb_stream_status_widget_text', $menu_item->title ); ?></a> </span>
And when create the menu entry don’t forget to write the abbreviation of the flag in the Attribute field of menu item.
e.g. it
- The topic ‘Add flags to widget’ is closed to new replies.