Website build log: It goes to 11!

Custom Post Types, Taxonomies, and Meta Boxes

20131027, 08:21 – MORNING!. Breakfast and morning walk, then custom post types, taxonomies, slug archive pages etc. The goal for today is to get a final permalink structure and basic navigation in place. And to maybe hopefully have enough time left to, oh… I dunno… relax or something.

10:04 – Initial cleanup and assembly of functions.php. Did some phone-reading during my morning walk and as a result of that I removed support for Post Formats. A decade of blogging has trained me to work without them, and they’re an inflexible entity – the choice is which formats to implement, not what formats to define. If I could bend the functionality so Covers had the Post Formats of “Wide Covers” and “Regular Covers” I’d be a happy camper. As it is the options are the standardized defaults and I’ve no use for those.

10:21 – I’ve started by copying over huge relevant chunks of the functions.php for a complex client site – all the structural bits I’m gonna need anyway. I’ve also used this (also here) snip of php to smack the ‘blog’ URL slug back onto blog posts where it DAMNED SURE BELONGS. Hopefully that doesn’t screw anything up.

Some sugar, get the media box rolling again, check the news and then it’s off to Taxonomies, CPTs and Meta Boxes. The foundation is LAID!

10:36 – Installments, Affiliations and Topics taxonomies are in place. These are the “categories” for the comic, the cast and the glossary.

10:53 – “Posts” is now magically listing twice. The function that adds CPTs and taxonomies to the dashboard is adding the altered Posts as a separate item. This could turn into a headache.

11:12 – Pulled my re-add of Posts. Will deal with that later. Added the CPTs. All CPTs still have Categories and Tags, which is very messy. I’ll clean that up later – I still have to add content to the CPTs and I still have to add custom meta boxes – right now it’s a coin toss as to which to do first.

11:27Tremors. Used Codepress Admin Columns to add Featured Images to the four CPTs. Refresh on custom meta – I always forget what an enormous pain in the ass it is.

12:01 – Custom meta boxes are in place. It’s going to take some actual theme development to make sure they’re working correctly, and to get started on that I’ll need to finally start moving comic pages and cast members and whatnot into their designated areas. But first… lunch! Custom Meta work was thankfully minor – a sort field for the glossary and cast pages and a previous/next override for covers and comic pages. The way custom meta boxes are set up I can easily add more to either the Sort or the Override in the future.

Note – If you’re following this as some sort of tutorial then this is the point where you back up your data. Seriously. Back the shit out of it. Dump that database, zip up the theme, batten down the hatches. I’m about to make major changes to the data structure – changes that will be a real pain in the ass to undo, changes that may be undoable without reverting to a backup. More importantly, these are changes that lock in the theme. Changes that cause your content to effectively “disappear” if the WordPress Theme is switched to anything else without proper preparation are no joke. If you’re doing something similar you’re a MORAN if you proceed without caution.

I backed up the database (and the rest of the site) last night before bed. The only changes made today have been the generation of a few empty “trash” files inside the CPTs, and the alterations to the theme functions.php file. As such the only item I need to back up at this point is the theme itself, and that was done before I wrote the above paragraph. As noted previously this document is being maintained outside of WordPress, and this would be one of the reasons it’s still a text file in a text editor.

At this point the Convert Post Types and Post Type Switcher plugins are activated, and I go back to fretting about boil time on the rice – my brain got sucked into braining on this and when I checked the rice it was boiling so I set it to simmer but I don’t know how long it was boiling and that’s kind of important.

12:27 – Got the posts converted and realized I need to bulk add/filter tags and categories into the relevant taxonomies… so BACK INTO POSTS they go, at least for now.

13:05 – Regenerated categories in preparation for bulk editing. Regenerating the tags will be much more tedious. Revised the “related tags” Taxonomy so it’s a proper tag-like thing now. I’ve added all taxonomies to Posts; all content is back in Posts for bulk editing. FUN!

15:11 – Sorted, or sorted very nearly enough so that any further efforts at sorting would be smacking into diminishing returns.

15:33 – Post types properly assigned; Admin Columns properly set up; post-type-fidgeting plugins disabled again for the time being. CPTs have been added to category and tag listings – I’ll probably eventually undo this depending on how things shake out – I had some trouble with tag listing on the DCRSA but in this case tags aren’t tags they’re Related Tags, a custom Taxonomy that behaves exactly like tags but isn’t.

15:43 – Dammit the sort term and comic overrides are conflicting.

15:51 – Sorted. Damned variables. Won’t know if they actually hang on to data for awhile yet but for now comic meta is on comic pages and cast meta is on cast pages. WHERE THEY BELONG. Now, a few chores and whatnot. Then the afternoon walk, then some work on the menu structure and base templates. Everything’s hanging together just fine at the moment, but I will be making deep, section-specific customizations across the board. I figure getting all of that working will be sufficient work for the day.

16:12 – Oh yeah – the permalink structure is doing what I want. /blog/%year%/%postname%/ >.>

17:32 – Post-walk. Just added a roles taxonomy to the Cast. Initial categories are Major Character, Minor Character, Primary Character, Secondary Character and Extra. Should help with sorting. Also added page-attributes to Covers, which will make them easier to sort.

Templates: GO!

17:48 – Slug pages for Blog root and Related root created – I want Related to be a jump-off point like it is on the old site, and Blog is going to function similarly. I’m about to delete a bunch of categories and tags and de-associate categories from the CPTS, so I’m doing a backup first. Just in case!

18:07 – Nuked non-blog categories, nuked all tags that won’t be used in the build process, added as Cosmology category to the Glossary and got rid of all of the @ tags – the associated objects are now properly sorted without them. “@ tags” such as “@important” are hidden internal/private tags in Movable Type – they don’t list in a tag cloud and I used them for various types of lists and functionality checks that can just be designed into the ATC theme.

18:51 – Remembered to add Multiple Post Thumbnails support to Covers – I’ll be using that to handle the “wide” instances, such as Book covers, The Dualist, Transitional Voices etc. Running out of steam – could be the weather (yeah right it’s 50 and clear), might be the fact that I’ve been pushing myself 12-14 hours a day for the last few weeks and haven’t really taken much time to decompress.

20:52 – I’m done braining for the day. I’ve labeled all the template files clearly, and I’ve created archive and taxonomy bases. I’d keep going with content but I want to sort all content and sidebar files into the includes directory (‘inc’) to keep things from sprawling too much. I may also need to create a few more sidebars, and I damned sure need to get a basic “list” sidebar working for use with the Glossary and Cast sections. I need to think about the data structure a bit more and I’m done thinking for the day. The site is very ugly at the moment, and barely functional. I figure it’ll be another day or two of basic template work before I can get started on the CSS and the prettying up. Very nearly all of the data is in WordPress and properly arranged on the backend – the next step is bringing that order to the front end.

21:38 – Well, “done braining” was a damned lie. MY LOOPS, LET ME SHOW YOU THEM. Related tags, check. Installment name, check. RELATED CAST MEMBERS INSIDE THE COMIC: CHECK. LIST OF COMIC PAGES IN THE SAME CATEGORY AS THE CURRENT PAGE, WITH THE LIST INCLUDING THE CURRENT PAGE? YOU BET. Now I just gotta figure out how to sort cast by a custom field, but before I do that the cast actually has to have custom fields.

So I just roughed out the comic archive sidebar, then.

Oh, and I finally wrote a damned array without googling reference or fumbling around for a working example (adding the comic_cover post type to the snip that outputs the page list).

Shit.

22:36 – Doubled down and wrote a proper if/else without much cheating. I’ve probably forgotten how to draw collarbones or knees or something as a direct result. I’ve also got pretty much all of the R&D out of the way, so I think I can STOP NERDING FOR THE NIGHT ALREADY.

23:55 – After I get the cast pages pulling recent appearances, tweak that, and spend like an hour idly clicking around. I think instead of “relaxing” I’m just going to go to bed.

20131028, 09:55 – Todays to-do list is pretty clear – keep pushing templates along until either they reach maturity or my hands give out. Yesterday’s RSI is less grumpy but my right hand has made it clear it’s had enough of my shit and wants some time off, so today might be minimal. I’ll see what a nice boiling hot shower does for it, then it’s off to the races.

11:12 – It’s taking awhile to get up to speed today. single.php is now firing properly, including CPT-specific content blocks and CPT-specific sidebars. The next step is to extend proper sidebar includes into taxonomy and archive templates.

12:42 – Everything’s list-ified and inc/-ified or close to it. The blog-specific sidebar has been fired up and I spent some time fiddling with that, wondering why wp_get_archives used to work as intended on Noise and doesn’t anymore – over there it’s supposed to highlight the post year and I was going to use that here but wp_get_archives doesn’t write out any thing the javascript I was using can hook onto. Monthly archives might be fine but that’s a huge MESS of an ugly-ass list I don’t want shitting up my templates dammit.

LET THERE BE LUNCH. FOLLOWED BY SHOVELING ALL THE RELEVANT BITS OF CONTENT-WHATEVER.PHP INTO SIDEBAR-WHATEVER.PHP.

14:44 – Comic and comic_cover sidebars are in fighting shape. I should probably move on to cast/glossary templates NOW and then deal with prototyping the FPNC brick after walk2 – that’s where I want to go next but I should probably stick to sidebars for awhile. :P The one for the Blog is widgetized and doesn’t really need to be; the one for the front is also widgetized. Comic and comic_cover sidebars are done. That leaves cast and glossary as major items, and a Page sidebar as a distant tertiary concern.

16:31 – The Glossary is firing correctly – that was mostly a snooze, but there was a maddening bit of AUGH that involved a re-write of the topics loop so it could be hooked properly for CSS. There’s still a lot of formatting work to do but most of the remaining problems will be solved in the Cast section, which I’ll be doing after walk2. Walk2 starts right after I save this and pee.

17:32 – Work resumes.

19:43 – Finally solved the “recent pages” loop. I was going to save it for the cast and backport it to the glossary but I wound up hacking it out in the glossary. That turned out to be a good thing, albeit a frustrating one – all cast members have Related tags but not all glossary entries do, and it turns out a ‘related’ check that returns nothing throws an ugly-ass error and had to be wrapped in an “if false” check. It would be another trip back into hell to tack page counts onto the list but the whole mess works without resorting to javascript or a trip to the support forums. It’s also now neatly compartmentalized into an include, which should drastically simplify work on the Cast section.

Break, a trip through the cast templates, then dinner. The related template and the comic FPNC can wait for tomorrow.

20:36 – After a painful amount of AUGH at the glossary, the cast just kinda snapped into place with minimal strain.

21:52 – So did the Related taxonomy archives, for some reason. I am deeply suspicious.

23:52 – Dinner, dishes, picking away at templates and then a partial recategorization of the cast. All of the broad-strokes navigation is in place, and that’s hopefully the major headaches taken care of. Tomorrow is more template work – getting the cast and glossary listing alphabetically, hopefully getting to the sort keys for both of those and the P/N override.

20131029, 08:13 – Added “recent edits” loops to the sidebars of Cast and Glossary conditioned on is_post_type_archive during breakfast. More substantial work when I get back from walk1. This wouldn’t be necessary with the old information design and isn’t technically necessary right now, but when templates are finalized the cast and glossary indices will be force-sorted alphabetically. At this point in time the sidebars for the support sections are now more complex than the sidebars for the comic. Go figure!

10:43 – The entries of Cast and Glossary now have sort keys and the sidebars now sort by those keys. I’m gonna pee, and then I’m gonna make the archive and taxonomy templates list by those keys as well!

10:53 – A minor adjustment to a snip of code from a client theme pasted into two archives and three taxonomies right before the loop and bang, done.

11:16 – Related page archive template setup; the “recent appearances” block edited to pull the comic list template (which still needs to be edited down). I think that’s all of the “meta” stuff taken care of – cast, glossary, and the related section.

12:11 – If I had a linear first/previous/next/current block without thumbnails I’d be done now. Hell if I had a linear FPNC with thumbnails I’d be done now. Alas, I now get to figure out how to call a post based on custom_meta.

14:17 – FPNC is working as intended and properly linked up. I still have to re-iterate it for the on-comic navigation, but that’s AFTER LUNCH. Possibly even TOMORROW. That work is a mix of PHP and CSS and I’d sooner save it until I’m closer to styling – I’ve only touched the stylesheet a couple of times at this point and I’d prefer to save it for “desert,” after major template construction has been dealt with. ALSO, IT IS TIME FOR LUNCH.

15:01 – Alphabetized the comic sidebar bits during lunch.

16:26 – Gearing up for walk2. Got a solid start on comic archives – the book and taxonomy (chapter) archives are doing what I want, though I still have to do a bunch of formatting work on the comic_cover list template and comic root index. I figure I’ll make that the priority when I get back.

22:46 – Walk2, then straight into template work. Forgot my snorkel. Finally came up for air with a completed comic archive – all that should be left on that is styling and probably caching. The comic root index takes a bit of effort to generate – hell, it took a lot of R&D and banging away to generate the templates. End result the comic covers section has another meta box and a couple of additional fields and in the process of getting those filled in I did link-vetting and SEO and post cleanup on all covers – so that block of content has been through pre-flight and is now loaded into the tuba. The firmed-up design now practically demands a cover for Observer Effect. Good thing I’ve been thinking on one.