For the sake of transparency, I’m going to talk about why OptimaList is not in beta or finished by now.
There’s lots of external reasons I had no control over, such as a two-year old son and client work and summertime.
But the main reason was me. Oh, I wasn’t procrastinating or anything. I work on it as often as I can.
But I wanted to write the best code. The most perfectly structured and as up-to-date code as possible. Or as possible as it can be with WordPress. I decided to only support PHP 5.3+, although I wish it was 5.4+.
PHP 5.3 means namespaces. I hadn’t been able to use them before so I had to read up on them.
I wanted to use the MVC design pattern. Had to read up on that since it’s been awhile. And on how best to use it in a WordPress plugin.
You know how the internet goes. You read one page and then you end up reading twenty more.
It took awhile for me to set up my models, views, and controllers as I wanted. This was just setting up the file structure and creating the namespaces, setting up the classes. No actual working code.
And then there was the templating system.
What do I have that works right now? A dashboard widget that says “test”. JS and CSS files that load but are empty. Two custom post types. An OptimaList menu item. Several metaboxes on the add new list page that are just blank or have one test form field.
Let me talk about the metaboxes for a minute. I’m not using CMB2 or anything because I don’t want to depend on others’ code for this plugin. So I set up my metabox controller, calling a new object for each metabox. Then I realized I was calling save_post for each metabox object, when it really only needs to be called once. So now I need to rethink some of my metabox code. This is just an example of how I’ve ended up overly complicating things.
If I would just write this plugin straight out, not worry about MVC or anything, this plugin would be done. Just write out each metabox code.
add_meta_box( 'my_meta_box', 'My Meta Box', array( $this, 'metabox_content', 'optimalist', 'normal', 'high' );
But instead I have an abstract class that I’m extending. That class contains:
add_meta_box( $this->main->get_plugin_slug() . '_' . $this->slug, $this->name,
array( $this, 'metabox_content' ),
I’ve been making this plugin’s code much more complicated than it needs to be. I’ve been having fun, but it’s taking much longer than I expected. I’m trying to stop and just write the code without making it overly complex, but it’s hard.
This whole endeavor I’ve been doing more than I have to. From setting up this website to coding the plugin. But I think it will be worth it in the end.