I had this custom page on my WordPress site where I would show only posts from a specific category. This was done manually, as in I PHP-coded a function into one of the theme’s PHP files to accept a shortcode, so it would do what I wanted it to.
There is a big chance that there is already a plugin that does this very thing, but the ones I found were complicated or over-engineered for what I need. I just wanted it to be simple.
So as a chance to learn more about the inner workings of WordPress, I searched the Internet and read manuals/examples. After an hour or so, I was able to create that PHP function to do that task – display posts from a single category on a specific page.
Happy as a clam I was… (but that was short-lived)
… Until the next theme update.
Where I did not really think it through and readily hit the update button. Only to realize later on that I did custom modifications on the theme itself. That means all of those are gone when I updated the theme. Didn’t have any backup as well. Or perhaps I did, on AWS as an EBS snapshot of the volume. But too lazy to spin that up, plus that would cost me too.
Determined to fix this debacle I proceeded to search for a solution. This time I wanted to go the plugin route. That way if there are any theme updates I didn’t have to worry about anything getting overwritten.
I was searching and searching and searching…. then I came across a very simple tip.
There is NO NEED for a plugin for what I required. Everything can be done via WordPress’s powerful editor. Now this solution works for me exactly how I want it to. Your mileage may vary. So go ahead and follow the 5 easy steps below to get you started.
Go to that page where you want to display the posts by category. Create that page if you haven’t yet.
Add a new block. Click on that round + icon. A pop up menu will come out.
Search for “Latest Posts” widget, then add it to the page by clicking on it.
Go to the Block settings that is found on the right-hand side of the page. Remember to click on that newly added block first. Then tweak it however you want it. Below is a screenshot of how it will look like initially. You can have more than one category too. It is all up to you.
Save your page.
Hope this helps someone with their WordPress blog customizations. Can save you a lot of trouble looking and installing a plugin. Enjoy! 😊
- > Creating A Static Front Page With WordPress September 21, 2009
- > Eclipse IDE Global Menu Hack On Ubuntu October 2, 2012
- > unSnap it! February 22, 2007
- > Novell Moonlight Is In A Lunar Eclipse September 24, 2011
- > Run Pipelight On Firefox March 29, 2015