I am looking for a way to display social media icons on my website. My icons alternate colors depending on the social media service.
- Priority number 1 - Sort the array items by alternating colors.
- Priority number 2 - Sort by color groups.
I would like it if it could have two conditional checks.
Firstly attempting to sort by alternating color. However, there may be three silver icons and only 1 blue icon.
Secondly, if alternating the colors didn't work. I would then prefer if it would just clump the icons by color instead. So I might have 1 blue icon first, following with 3 silver icons after.
Here is my array of icon data:
Array
(
[0] => Array
(
[service] => twitter
[url] => https://twitter.com/1/
[color] => silver
)
[1] => Array
(
[service] => google_plus
[url] => https://plus.google.com/2/posts
[color] => silver
)
[2] => Array
(
[service] => facebook
[url] => https://www.facebook.com/3/
[color] => blue
)
[3] => Array
(
[service] => linkedin
[url] => http://us.linkedin.com/company/4/
[color] => blue
)
[4] => Array
(
[service] => youtube
[url] => http://www.youtube.com/user/5/
[color] => silver
)
)
I am not necessarily looking for a full fledged code solution to my question. More or less just looking for advice on how I can achieve this or what functions I should use.