This weekend I was determined to create a custom post type (CPT) for my wine website. My initial plan was to create the CPT as a plugin, since that’s what Greg recommended. It turns out that’s a little more complicated than I thought it was when we went over the concept at 9:15 p.m. last Tuesday. I browsed the Codex for a refresher and did many Google searches, but unfortunately I couldn’t figure it out. So I moved on to plan B and placed the CPT code into my functions.php file. Once that step was complete, I connected to my local server and checked my WordPress admin panel. It was a miracle…my new “Wine” CPT button was added right below the comments button.
This was a great accomplishment, but having the CPT only display on my local admin won’t do me any good in the future when I want to add content. So I decided to commit/sync and drag my updated functions.php file into Cyberduck in an effort to get my CPT to show up on my web admin panel – piece of cake, right?
Wrong. After Cyberduck was finished downloading, I refreshed my website… and screamed because the screen turned white with a fatal error message. This was the first time I received an error message of this magnitude, so I was freaking out. But instead of throwing my laptop across the room, I deleted the functions.php file from Cyberduck, and that apparently fixed the problem. But, I’m still without the CPT on my web admin menu.
Sidenote: I found this handy “Common WordPress Error” resource page in the Codex, which I will now be bookmarking.
I want to revisit plan A – creating the CPT as a plugin – but I plan on doing some additional research before experimenting again on my site. For now, I will continue making style changes in the css and gathering content that I plan on incorporating.
I have to admit, I was a little skeptical about learning command line. Isn’t clicking easier than typing? But after actually going through the motions in class and browsing the readings, I understand why command line could be very useful in some situations. In my job, I often have to convert image files to different formats. Sure, clicking a button or two to convert one image is definitely faster. But, what about 1,500 images… in a short period of time? Typing a command that’s a few lines long would be much more efficient.
It’s actually cool that you got a white screen of death. It’s better than tip-toeing around your website afraid to ruin anything. In fact, when I first read your post, I thought, “Damn, we’re already doing CPTs?? I don’t even know what a CPT is!” Too bad it didn’t work. Nice effort though. I’m hoping to follow in your footsteps. I’m a little behind now (due to the week away), but I think I’ll be screwing up my webpage in no time. Good luck with your next coding “adventure!”
Getting a white screen that literally said FATAL was super scary and I hope no one has to go through that. I literally thought my entire site was gone. But I hear what you’re saying….I guess it’s better to try and fail than not try at all, right? We only briefly discussed custom post types in the last class, so I hope Greg discusses them in more detail in the next class.
Yes, we can discuss the “how” of custom post types further this week.
Breaking things is a key step in the learning process! Try re-enabling it and going step-by-step to check it against examples.
Yes, exactly right about command line. That’s a great example of scripting something to automate a task and then executing via command line.