I do build WordPress sites and plug-ins, though I consider myself more of a PHP developer, and that’s how my mind thinks first, not immediately knowing a lot of the available WordPress functions.
I need to build a custom plug-in for a client, to add the ability to host online contests. The actual contest parts I’m good with, as that will be PHP, but I’m trying to figure out the best way to interface the contests with WordPress. The URLs will be like…
sitename.com/contest-name/ – most current contest (will show either voting or results depending on status)
sitename.com/contest-name/2021/ – past contest (will show results)
There are three different types of contests –
– Single-category: All entrants are competing against each other
– Multi-category: Entrants are competing against others in the same category
– Survey: The contest is closed to the public and voters are authenticated
My first thought was to do it all in PHP, but then I thought for the URL structure, maybe each contest should be a custom post type “contest”. But then I went down the rabbit hole wondering if each year should be a separate post, or should I have contest-X be a post of type “contest” and then handle the individual years with custom PHP.
Also… where would I specify the type of contest? I’d just want to limit it to the three types, and require that each contest have a type specified. Post_meta is probably the place for it, but it’s higher level than even the title, so I was considering putting it in an unused field right in the posts table (post_excerpt?).
I also considered making it shortcodes, and the client can just make a new page with the URL they want and put in shortcodes for the contest. Though that would require more work from the client that I was hoping the plug-in would streamline.
I’m sure there are other WordPress ways to approach this as well. I can really code it in any of them, I’m just finding myself second guessing “What if I spend weeks working on it one way and realize it would have been much better to do it this other way?”.
Is there an approach that more experienced WordPress developers would agree “This is the way to approach it”?
[ad_2]