MLS Season Tracker Plugin for WordPress

I made a WordPress plugin to help visualize match results and double as schedule that would allow me to easily see who and when we were playing. If you operate a WordPress-based site you can use it to track the Portland Timbers, or some other, inferior MLS team. Rolling over one of those squares will give you the match date, and if the match is finished, goals, and other results. A running tabulation of the season is kept at the bottom, and you can sort by home or away, conference, and games played, and more.

You can see it under the banner at the top of every page. Those are generated by a function called in the theme template. You can also generate it inline with shortcode in a post. [See below]

2016 Timbers Schedule and Results

March 6, 2016: Win
Goals For: 2
Goals Against: 1
GP: 1
PPG: 3
Conference: 3
Supporters Shield: 6
MLS Power Ranking: 1
March 13, 2016: Loss
Goals For: 1
Goals Against: 2
GP: 2
PPG: 1.5
Conference: 6
Supporters Shield: 9
MLS Power Ranking: 2
March 19, 2016: Draw
Goals For: 2
Goals Against: 2
GP: 3
PPG: 1.33
Conference: 8
Supporters Shield: 13
MLS Power Ranking: 3
April 3, 2016: Loss
Goals For: 1
Goals Against: 4
GP: 4
PPG: 1
Conference: 9
Supporters Shield: 16
MLS Power Ranking: 8
April 10, 2016: Draw
Goals For: 1
Goals Against: 1
GP: 5
PPG: 1
Conference: 9
Supporters Shield: 17
MLS Power Ranking: 10
April 13, 2016: Loss
Goals For: 1
Goals Against: 3
GP: 6
PPG: 0.83
Conference: 9
Supporters Shield: 17
MLS Power Ranking: 10
April 16, 2016: Win
Goals For: 3
Goals Against: 1
GP: 7
PPG: 1.14
Conference: 8
Supporters Shield: 14
MLS Power Ranking: 8
April 27, 2016: Draw
Goals For: 1
Goals Against: 1
GP: 8
PPG: 1.13
Conference: 8
Supporters Shield: 13
MLS Power Ranking: 10
May 1, 2016: Win
Goals For: 2
Goals Against: 1
GP: 9
PPG: 1.33
Conference: 7
Supporters Shield: 9
MLS Power Ranking: 9
May 7, 2016: Loss
Goals For: 1
Goals Against: 2
GP: 10
PPG: 1.2
Conference: 8
Supporters Shield: 10
MLS Power Ranking: 8
May 11, 2016: Loss
Goals For: 1
Goals Against: 2
GP: 11
PPG: 1.09
Conference: 9
Supporters Shield: 13
MLS Power Ranking: 8
May 15, 2016: Loss
Goals For: 1
Goals Against: 2
GP: 12
PPG: 1
Conference: 9
Supporters Shield: 15
MLS Power Ranking: 12
May 21, 2016: Win
Goals For: 4
Goals Against: 2
GP: 13
PPG: 1.15
Conference: 8
Supporters Shield: 13
MLS Power Ranking: 11
May 28, 2016: Draw
Goals For: 1
Goals Against: 1
GP: 14
PPG: 1.14
Conference: 8
Supporters Shield: 14
MLS Power Ranking: 11
June 1, 2016: Win
Goals For: 1
Goals Against: 0
GP: 15
PPG: 1.27
Conference: 7
Supporters Shield: 10
MLS Power Ranking: 9
June 18, 2016: Draw
Goals For: 2
Goals Against: 2
GP: 16
PPG: 1.25
Conference: 8
Supporters Shield: 12
MLS Power Ranking: 9
June 26, 2016: Win
Goals For: 3
Goals Against: 2
GP: 17
PPG: 1.35
Conference: 5
Supporters Shield: 8
MLS Power Ranking: 8
July 4, 2016: Draw
Goals For: 0
Goals Against: 0
GP: 18
PPG: 1.33
Conference: 7
Supporters Shield: 10
MLS Power Ranking: 7
July 10, 2016: Draw
Goals For: 0
Goals Against: 0
GP: 19
PPG: 1.32
Conference: 7
Supporters Shield: 10
MLS Power Ranking: 7
July 13, 2016: Draw
Goals For: 1
Goals Against: 1
GP: 20
PPG: 1.3
Conference: 7
Supporters Shield: 11
MLS Power Ranking: 7
July 17, 2016: Win
Goals For: 3
Goals Against: 1
GP: 21
PPG: 1.38
Conference: 6
Supporters Shield: 8
MLS Power Ranking: 6
July 23, 2016: Win
Goals For: 2
Goals Against: 1
GP: 22
PPG: 1.45
Conference: 7
Supporters Shield: 11
MLS Power Ranking: 11
July 31, 2016: Loss
Goals For: 0
Goals Against: 1
GP: 23
PPG: 1.39
Conference: 7
Supporters Shield: 12
MLS Power Ranking: 11
August 7, 2016: Win
Goals For: 3
Goals Against: 0
GP: 24
PPG: 1.46
Conference: 6
Supporters Shield: 10
MLS Power Ranking: 9
August 13, 2016: Loss
Goals For: 0
Goals Against: 2
GP: 25
PPG: 1.4
Conference: 6
Supporters Shield: 11
MLS Power Ranking: 11
August 21, 2016: Loss
Goals For: 1
Goals Against: 3
GP: 26
PPG: 1.35
Conference: 6
Supporters Shield: 11
MLS Power Ranking: 12
August 28, 2016: Win
Goals For: 4
Goals Against: 2
GP: 27
PPG: 1.41
Conference: 6
Supporters Shield: 11
MLS Power Ranking: 10
September 3, 2016: Loss
Goals For: 1
Goals Against: 3
GP: 28
PPG: 1.36
Conference: 6
Supporters Shield: 11
MLS Power Ranking: 11
September 10, 2016: Win
Goals For: 1
Goals Against: 0
GP: 29
PPG: 1.41
Conference: 6
Supporters Shield: 10
MLS Power Ranking: 9
September 17, 2016: Win
Goals For: 2
Goals Against: 1
GP: 30
PPG: 1.47
Conference: 5
Supporters Shield: 9
MLS Power Ranking: 7
September 24, 2016: Loss
Goals For: 1
Goals Against: 3
GP: 31
PPG: 1.42
Conference: 6
Supporters Shield: 10
MLS Power Ranking: 11
October 1, 2016: Loss
Goals For: 0
Goals Against: 1
GP: 32
PPG: 1.38
Conference: 7
Supporters Shield: 13
MLS Power Ranking: 14
October 16, 2016: Win
Goals For: 1
Goals Against: 0
GP: 33
PPG: 1.42
Conference: 7
Supporters Shield: 12
MLS Power Ranking: 10
October 23, 2016: Loss
Goals For: 1
Goals Against: 4
GP: 34
PPG: 1.38
Conference: 7
Supporters Shield: 12
MLS Power Ranking: x
Show All | GP: 34 | PTS: 47 | PPG: 1.38 | GF: 49 | GA: 52 | GD: -3 | WLD: 13-13-8 | H: 13-2-2 | A: 0-11-6 | WC: 10-10-4 | EC: 3-3-4 | WCS: 7 | SS: 12 | MLSPR: x | KEY
Won
Loss
Draw
Above the line
Below the line
Away Game

 

The project started last season. Once I figured the basics of how I wanted it to work, I coded up some CSS, Javascript, and PHP to make it work. It’s pretty easy in a one use situation, where you’ve only got one season and you’re only interested in one specific team. Updating results was a matter of editing a text file with serialized information. It was simple, but not simple enough. I wanted to be able to do the whole thing in the backend of WordPress, make it reusable, and not limit it to one team. I imagined a scenario where someone might want to show two different teams on the same page, or the same team in multiple seasons. Simple enough… sort of. It needed to be flexible enough to easily accommodate expansion teams and teams that switch from one conference to another during different seasons. Figuring out the approach to take was the hardest part. It would have been easiest to create my own tables in the MySQL database, but I considered it a challenge rearrange my thinking and make it work with custom post types, taxonomy, and custom meta boxes.

Installing and activating the plugin automatically creates the teams. It’s up to you to create the matches and sign home and away teams to each match. You can do it manually, or you can upload it in a CSV spreadsheet and do it all at once. I used the MLS calendar subscriptions viewed in the Google Calendar, agenda tab. A copy and paste into a text document and some search and replacing made it a pretty quick affair, and one where I didn’t have to worry about typos on match dates. Now that I’ve got it figured out, I might even consider converting some other teams schedules and making them available for others.

Implementing it in a site can be done with a function call in a template, or shortcode in a WordPress post or widget. Of course, if you fail to specify a team, it defaults to the mighty Portland Timbers. After a game is done, you edit the match with the goals and optional information like Conference and Supporters Shield standings. If you’re logged in as an admin you’ll be able to access edit links directly from the match info rollovers.

On the roadmap, I want to submit it to the WordPress Plugin Repository. There are some minor options I’d like to add, and some tweaks to the UI. Once that’s tackled, I want to work on making the CSS more elegant, but I figure that can wait until the mechanics are more or less complete. Also, the interface is based on rollovers, so I need to make it work on touch devices too, because apparently these new-fangled iPhones and iPads are going to stick around…

I’d love to hear feedback. Until it makes it to the official repository, you can download the code here. No, I’m not on Github.

Leave a Reply