Every week, there are 15 new League of Legends champions you can try out for free. My plugin lets you show their icons in any WordPress website. I connect to the Riot Games API, cache the data every hour and I forward it to you.
Free To Play this week
The images above are a live example of how it works. When hovering over a champion’s avatar, you can see their name and title.
The plugin is available in the official WordPress database. You can search for it in the plugins section of your admin panel or you can download it by clicking this link:
This is free to use and it doesn’t require any account or access key.
What features does it have?
Similar to every other WordPress plugin, you can edit the Title and Description of your widget. Both will be shown above the champion list.
I’ve also added a maximum Width option. This helps non programmers customize how much space the plugin takes. It accepts numeric values (200, 300, 1000) or string values (100px, 50%, 16em). If you leave it empty, it will be defaulted to “auto”.
I made an update on 17 August 2020. This version gives you the option to use shortcodes. Add them in any content area of your WordPress website. Posts, pages, custom elements, you name it. They will have the same result as the widgets.
[lolrotation width=400 creditauthor=1]
How did I make this WordPress plugin?
Let’s get Technical! The code is split in 3 different entities.
The first part consists of a PHP script that connects to the official Riot Games API. You can find their documentation here. I applied for a permanent key so you don’t have to.
A cron job will get the data and save it along with the current timestamp in a JSON file. Whenever a new request comes, based on the timestamp, it will decide if data will be refreshed or not. This is how I cache the information and avoid too many uses on my limited API key.
The second part is another PHP file that converts my cache into an API endpoint. I had 2 options here. I could also go with an embedded HTML iframe, but that would limit webmasters that use the plugin. They can’t manipulate or edit the styles from within it.
The third and final element is the plugin itself. All the customization is coded with PHP. The champion avatars are loaded into the website by an AJAX call using jQuery.
That’s it! I’m done with the boring stuff 😀
Thoughts and Suggestions
I created this plugin as an experiment. It will always be free. If you have any questions, feedback or suggestions, leave a comment down below.
Thanks for checking out my project.
Disclaimer: LoL Free Champion Rotation isn’t endorsed by Riot Games and doesn’t reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.
One Reply to “LoL Free Champion Rotation WordPress Plugin”