Site icon WebDevStudios

Generate Content with the Business Matchup WordPress Plugin

I created the Business Matchup WordPress plugin to generate content because I noticed that writing engaging content is sometimes tricky. The main issue being that it takes too much time.

Thinks about it. You sit down and consider what you want to share. Then, there’s  planning, proofreading, deleting, starting over, and the eventual moment of pushing publish and calling it a day.

I pondered ways that you could generate some engaging content, knowing it had to be simple. However, it could not be so simple that the resulting content would be brief and not very engaging.

Generating content with a WordPress plugin needs to be easy, but also empowering. The process must allow you to sit for only a few minutes to make three or four decisions and then walk away.

That’s when I stumbled onto an idea while talking with my friend Glenn.

How to Generate Content Easily with a WordPress Plugin

What if there was a way to create a poll that you could then share with your friends, followers, current customers, and potential customers that allowed them to share their opinions with you in a fun and nonintrusive way?

Glenn and I thought of ways to engage with people in our community, other businesses, while also voicing which ones we liked the most. This was the perfect starting point to the content generation concept that had been at the back of my mind.

By the way, this is also the moment where I chose to challenge myself, level up my coding abilities, and pursue the goal of not only writing a new plugin, which I’ve done before, but also submit it for approval to the WordPress plugin repository.

Planning for Development

Now that I knew what I wanted to do, it was time to develop the rules of my new challenge. 

  1. Security: A plugin that generates content needs to be above the WordPress coding standards and pass multiple security checks.
  2. Collaborative code: This codebase needs to be open-source, and it needs to be readable by humans who may want to extend or add features.
  3. Pass peer review: I knew my new WordPress plugin would be reviewed upon submission by the WordPress plugin team, and I had to be sure it would pass.
  4. Clear and helpful documentation: Just because I know how to use my content generating plugin doesn’t mean everyone else will. Helping users understand how to get started and how to use this plugin was a big goal for me.
  5. Five for the Future: The plan was to make my plugin a collaborative project, so why not reach out to others and invite them to participate and give back to the community in the process? It could be their opportunity to participate in the WordPress initiative Five for the Future.

Now that all of the planning was out of the way, I was ready to begin working on the first step of the process and create the public repository for the code to reside in during development on GitHub.

Welcome to the world, Yelp Polls!

Wait, Yelp Polls? Yeah… we’ll get to that later, but follow along with me for a moment.

Security

One of the first questions I asked myself was, “How can I start coding from a known good spot and ensure that my code is secure before it goes out into the wild?”

I could enforce local coding standards within my editor and follow best practices. But, that’s boring, and I already do that.

What about integrating security and linting services to validate the published codebase to see if it can pass more than just the WordPress standards? I did some research, and I settled on one that I can run locally in my terminal that would help me identify security issues within the dependencies my plugin might end up using.

snyk

Getting set up with snyk was pretty straightforward, and it allowed me to safely scan my project on my local machine before I submitted the code to the repository on GitHub. After that was in place, I used the WordPress plugin scaffold within WP CLI to start creating my new content generating plugin quickly.

I wrote a few simple functions and then pushed the code to the repository. It was now time to integrate the Codacy service with the GitHub repository and get the first nightmare of issues to resolve and fix.

This was when I knew I was on the right track if I was trying to challenge myself. Right out of the gate, I had issues to resolve that came from some code I didn’t write and some code that I did. 

After a few moments of triaging and addressing these new issues with the code, I continued coding and got back to work.

Collaborative Code

One of the bad habits I struggle with is that I generally neglect to document my classes and functions in personal projects like this one. And, I couldn’t let that happen here.

I needed to identify the types of variables others would be using and what could be expected. Just because I know what is happening with a plugin I developed, doesn’t mean that someone else will.

It was quick to write out the documentation blocks. The plugin was now well on its way.

Acquiring Assistance, Hitting a Roadblock

I also had one of my favorite days at WebDevStudios (WDS), Five For The Future (5FTF), in my near future. During various meeting, as my coworkers and I discussed what projects we had planned for that day, I mentioned my plugin designed to generate content and how I could use some help with the styling and design for the content pages. 

My former teammate, Christina Workman, said she would be happy to help out with that, and help she did! With her assistance, the cards that the business locations were going to be placed into were now using Grid CSS and were mobile responsive. In addition, Christina’s volunteered time allowed me to focus on the API integration with the Yelp API service and StrawPoll.

By the end of the day on February 25, 2022, the plugin was working. Plus, the code was passing almost all of the linting on Codacy without any issues.

So you caught that, too, right? Almost.

Yeah, this is where I ran into an issue that I still can’t resolve at the moment.

So, I put the case to our entire engineering team here at WebDevStudios, and we all came to the same conclusion. You can’t satisfy this linting rule pattern because you have to include, require, include_once, or require_once your autoloader for PHP to know where to load your classes from if they are in other files.

I left the note regarding the issue as a comment in my plugin and left it at that. Case closed. Or, so I thought.

Pass Peer Review

As the day came to a close, I was pretty confident in the state of the plugin. I was excited to submit it to the WordPress plugin review team. However, before I could, I knew I should go back through the plugin guidelines and ensure that I didn’t overlook anything. 

There it was, the one item I had overlooked. And, this one was going to require me to rename the plugin.

From Yelp Polls to Business Matchup

I was pretty annoyed by this revelation, and I blamed myself for not catching it sooner. Outlined in the plugin guidelines is rule number 17. It stared back at me as if I owed it money. I can’t prefix my plugin with the word Yelp because that’s a trademarked name. 

I spent the weekend kicking around various name ideas that conveyed what you could do with the plugin while still being fun and inviting. Then, after I settled on the new name, I had to back through the plugin code and replace all of the areas where I had used ‘Yelp Polls’ so that I was following best practices and helping keep things identified. 

The following week was pretty rough. I misunderstood what the plugin review team had wanted me to correct initially and changed the prefixes of my function names a few times.

Another Roadblock

Once the changes were completed and submitted, I got another email. This one pointed at the comment I left in the plugin regarding that linting rule that I couldn’t resolve. Yeah, that comment.

Their discovery of that comment started that conversation again, and this time it was with the WordPress plugin review team. We had a few back and forth emails about the issue, and I was given some methods to try, but none of them resolved the problem with the Codacy linter.

Finally, I made the swap I was trying to avoid and swapped my autoloader out for the simple option and went with using Composer. Using the Composer autoloader allowed me to use a PSR-4 based autoloader, follow best practices, and clearly define the classes I wanted my plugin to load.

This also meant that I needed to refactor the plugin. I mean, I might as well since I’m already ripping things out here.

After the code was refactored, I sent another resubmission to the review team. My confidence was starting to shake that this would pass review.

Another email came in a few hours later. The review team could still see the problem in my code and not the new composer autoloader.

I went back through the code on GitHub. No, this is using the composer method. Next, I checked the zip file in the release using the link I sent the review team, and no, that is also definitely using the new composer method.

Then, I asked them to check again and sent them the link, and I could see from their reply and screenshot that they do not see the updated code. I bumped the version of the plugin once more and made a new release. My email inbox went silent.

Then, it happened.

The weekend passed, and the plugin review team still had no word back. So, I direct my attention back to my work, pressed on, and refreshed my inbox every once in a while as I went on about my day Monday.

On March 21, 2022, an email notification popped up just before my morning team meeting. It said, “Business Matchup has been approved!”

My jaw dropped, and I could barely contain my excitement as I joined a Zoom meeting. Talk about perfect timing! It was our monthly 5FTF Friday at WDS.

I published my first plugin to the WordPress plugin repository, and I met the challenge I put before myself. It just shows how good it feels to set a goal for yourself. If you persevere and push yourself, you will be successful.

Yeah, the bar was a bit higher than usual. Yeah, I struggled a bit here and there. At the end of it all, though, I can see just how much I learned and grew through that process.

In my next blog post about Business Match, I’ll share what I struggled with when writing a readme file, showing documentation to users, and the steps I took to deliver on the goal I set for myself regarding that documentation.

You can find the new plugin on WordPress today under the name Business Matchup, and if you do happen to check it out, you will also see the link to the documentation.

Contribute often, dream big, and push hard for those goals that you set for yourself. You can do this. I did.

Exit mobile version