Have you ever wanted something to appear on your blog, and you cannot quite figure out how to do so using the usual editing tools that WordPress provides? Do you have products or services you would like to highlight? Do you have a particular message you want to show up in a certain way under each post, and none of the plugins that you have examined seem quite what you need?
Lenie of Frugal for Everyone contacted me early this fall and asked if I could help her display her Etsy products under each post. What I did was I wrote a small plugin specific for her needs. I will talk about the plugin in general, and then I will provide a few more of the technical details (so if the technical part is too much, feel free to skip it).
Display Products Under Post – Overview
The idea was that at the end of a post, on top of the comment area, one should be able to see a thumbnail, description and title of a certain product. If you are already using an e-commerce solution like WooCommerce there are plugins to do this. However, in this case the products are on an Etsy Shop. What was needed was quite simple: a custom content type for the products and some code to display them under each post.
A section for these Products was added to the back end left column. The client just needs to go in and add a new product, adding featured image for the thumbnail, description in the body and a title. Custom fields for price and for the Etsy link were added as well. Editing a product is as simple as editing a page or post. If a product is no longer needed, it can be deleted. To keep a product in the back end but have it not display, one simply changes the status to draft.
Display Products Under Post – Technical Details
If you want to do something similar on your blog and you are comfortable with coding, this is not too hard a project. The first part would be to set up a custom content type. You can use a plugin called CPT UI to help you do this. There are also tools to help generate code for a custom content type. I would highly recommend putting all the code in a plugin and separate the whole thing from the theme. So, yes, you need to know how to create a simple plugin. Finally, you need to be able to display the custom content type. I wrote a plugin that basically tacks the products at the end of the ‘the_content’. How the products look is controlled with CSS.
Projects for Your Own Blog
Sometimes you may say: I want something to appear automatically over here. You search for a plugin, but whatever you find doesn’t do quite what you need. It might be complicated for a developer to put together, or it may not. In this case, it was something I enjoyed creating and did not take a lot of work on my part, as I have lots of experience with coding. But I’ve heard of some ideas that I would not touch with a ten foot pole.
Over to You
Have you ever had custom coding work done for your blog or website? Did it work out well or did it not? Is there anything you would be curious could be done on your own site? If you have visited Frugal for Everyone, did you notice the products under the posts?