I’m new to WordPress development and I’m stuck. My background is web development from 10+ years ago with just PHP and no CMS. Anyway, my wife and I create a calendar every month of what we’re going to have for dinner. I want to automate this and have it display inside WP and use the theme. I have no idea where to start with this.
I want it to have its own DB tables because I want to be able to add or update entries from the page. I want it to mark when an entry was used last so that we’re not eating the same thing every month, etc. From what I’m reading, at this point I either need to create a custom page template or a plugin. I don’t feel like either makes any sense: a custom page template for one instance of a page, or a plugin to add content to the page and not the admin. I don’t think you can add custom PHP to pages without plugin support, and the testing I did with that didn’t function at a deep enough level to accomplish this.
I’m thinking that the whole issue here is my thinking. I don’t know how to make WP do what I need to do outside of make basic information look pretty – it feels like they’ve stunted PHP, or to make it useful you have to shoehorn in a plugin. A good example; I have a very old page that accessed a DB instance to pull out all the pictures I had and display them in a grid by category – this is all straight PHP. I’m trying to make WP work this way and I just don’t think it does. I’m finding the gallery tools nice, but I have just so many pictures the picker stops loading halfway through. So again, I’m not sure if WP just isn’t designed for what I want, or if I’m just thinking about it in the wrong way.
Can someone please give me some pointers to get started here? Very much appreciated.
-Sean
]]>You plan your dinners a month in advance? My goal is to have it figured out by 5PM each day. ??
]]>I guess I’ll take a peek at how they made these calendars and go from there. Just hard getting out of this mentality that I should make a page and just go to town with PHP inside it to do what I want. Thanks for the reply!
]]>It kind of sounds like you’re looking for a coding project as a learning experience. If so, examining how plugins do things can be very instructive, but you’ll learn more doing your own thing. It’s not a very productive approach, but it is instructive. You can certainly create your own table, but there’s typically no need. Meals can be managed as posts if posts aren’t needed for blogging, or you can create your own post type — “Meal” or whatever. Data you don’t want as post content can be stored in post meta. You can assign taxonomy terms to help you organize things. WP provides category and tag taxonomies, but you can create your own.
Your custom code should be contained either in a plugin or child theme. Neither one is a big deal. If you will be making custom templates you are better off with a child theme. Other than that, plugins are better for altering functionality, themes for altering appearance, but there can be a huge amount of cross over. So much that either vehicle can be used for virtually anything if you really wanted to. You can do both if you’re so inclined.
What you learn doing this will serve you well if you want to update your photo galleries. But again, if you just want an easy way to have galleries, find a plugin. But you will learn a lot developing your own gallery theme or plugin.
Since you have PHP skills, you can get WP to do anything that’s possible with PHP. But doing so in a way that is most compatible with WP has to come through experience. You can always come up with something that works, but there may be better ways of doing it with WP. Again, studying what plugins do can be very informative. Sometimes they can also be confusing if not useless, it depends on how well coded the plugin is. There are all kinds, from top notch professional to barely tolerable piles of nonsense.
If you want to roll your own, or even modify another plugin, you can start by reviewing the Plugin Handbook.
]]>