Different themes for different comics
Has the support for associating different themes with different comics changed in Webcomic 3? The old method of using “webcomic-slug” as the theme name doesn’t seem to be doing it anymore. I took a peek at the code, and I didn’t locate any stylesheet filter hooks, like there are in webcomic_series_template() in Webcomic 2, so I’m wondering if this is still supported.
My apologies jhicks; this feature was removed from the initial release of Webcomic 3 as I couldn’t for the life of me get it work right for some reason. I’m still working on it and hope to have it available very shortly in a way that’s even easier to use than it was in Webcomic 2.
I’m not sure if this is new to more recent versions of WordPress or not, but while working on adding this I remembered why it was left out in the first place: it seems that there’s no way to properly change the complete theme.
The
templatehook doesn’t work the way one would expect, so only thestylesheethook is in effect, which only swaps out the theme stylesheets (not whole template files). I’ll keep the feature in anyway, since it’s probably still just as useful as it was in Webcomic 2.The way it’ll work in Webcomic 3.0.2, btw, is that you can select which theme to use on the Edit Collections page; no more
webcomic-{slug}stuff. Just pick a theme on the Collections page and it’ll grab the stylesheet for that theme (and hopefully template files as well, if I can ever figure that out XD).Just being able to change the stylesheet would be enough for me. Heck, even just being able to use the “custom background” and “header” options in Inkblot per comic would go a long way toward what I need.
Using custom background and header per-collection would be very interesting… I’ll have to see how much WordPress allows one to hack into those. XD
Wow, thanks! That was quick. One little question, though. The stylesheet isn’t automatically switched for my webcomic home pages. Do I need to manually add the integer value of the term for each comic series as a webcomic_collection custom field on each different Webcomic Home (and presumably Webcomic Archive) page, or did I miss a setting somewhere? I’m able to follow where hook_save_post() in Inkblot’s functions.php looks like it ought to be updating webcomic_collection, but can’t quite puzzle out why it seems not to.
Oh, also, how do I get at that ID short of using a PHP debugger of some sort? To say I’m a WP and PHP n00b would be a dramatic understatement…
Ah yes; WordPress likes to hide those ID’s from us. XD The easiest way I know of is to go the Collections page, click on a Collection to edit it, and then look in the address bar. There should be part of it that looks like.
which will give you the ID.
For homepage themes, I may need to go back and tweak things a little. The actual homepage is “special” in that it’s technically generic so it might take some work to get it switching properly. The homepage template should work, but I may need to tweak Webcomic to look for the Collection ID in the right place.
OK, so… until/if you are able to implement custom header/background per collection, if I define a different background or header for the theme for a second collection in the style.css for that webcomic’s theme, will it override the custom header/background? And are the tags for these different than they were in webcomic/inkblot 2?
Switching stylesheets on the comic home pages works aces just by adding the webcomic_term value as a custom field named webcomic_collection to the page. Haven’t tried it with archive pages yet, but looks to me like it should work the same way. Yay!
Also wanted to note that the main theme is working exactly the way I want it to, which is this: I have the site set to not show a comic on the home page. That’s reserved for news posts and blog stuff, and is meant to use the theme that’s set in the WP control panel, which it does. Perfect! I recall having some trouble getting the same setup to work the way I wanted with Webcomic 2, so the upgrade is already more than worth the effort to me. :-)
Because of how WordPress’ custom headers and backgrounds work you probably wouldn’t be able to redefine them in a stylesheet since it actually spits out a
<style>tag in the<head>section (which takes precedence over any externally-loaded stylesheets).Inkblot 3 is built using HTML5 elements, so things are a bit different. The entire header is wrapped in a
<header>element (with a#headerID). Inside of that is an<hgroup>element, which contains the header text, and a<nav>element, which has the main site navigation. Inside of the<hgroup>element is an anchor tag (<a>) and an<h2>for the site description.Further inside the
<a>there’s the main<h1>element (yay for HTML5 allowing anchors to wrap block-level elements). To set a custom header, I’d use something like the following CSS:I’d like to bump this thread a little and say that I started running WordPress in Multisite mode in order to split my sites up into separate domains again. (I originally had them as separate installs of WP but that became a hassle to keep updated. I lumped them onto the main site using Webcomic’s multicomic support)
Multisite mode isn’t perfect but once you learn your way around it it’s fairly handy. You get one location for themes and plugins you can activate by site or across your entire multisite network. Each site has their own dashboard, can have their own themes and plugin settings, and when there’s updates available you only need to do it once. There’s not too much on integrating stuff on all the sites yet but that’s probably going to change quickly as more people start using it.
So far the hardest thing was actually divvying up the categories and having them display cleanly on their own subdomains. Once they all got imported properly I ran the upgrade tool on each of them. (Though on one site I had to downgrade Webcomic and re-update it because I didn’t clean out unused categories properly before updating it.) Really my only complaint so far has been with WordPress’ import/export tool which choked on importing my larger files and didn’t export categories properly. Now I just need to customize the themes and clean up some errors the importer caused before rerouting the domains.
I’m trying to do what jhicks described, but it isn’t working for me.
I’ve added webcomic_collection as a custom field in each comic home page, and set the value as the webcomic_term value found in the Collections section. I updated each custom field, updated the page itself. Still nothing.
Any ideas would be much appreciated! I really need the webcomic home pages to use the unique stylesheets.
Also, I need to figure out how to use custom bgs for each comic. I managed to do this with the header image (think I took some code out of the header.php) but how can I do the same with bgs?
What code would I remove from where to stop it using the bg defined in the WordPress CP?
Just bumping this cause I still live in hope, and this is quite important for my little webcomic.
I’m gonna try bumping this one more time.
I’m not sure what to do if I can’t have seperate header titles and background images for each of my comics, but it can’t stay as is. I might have to consider merging them all into the one comic again. As things stand, my readers are just getting needlessly confused.
Just to come back to this: Rebecca’s problem seems to stem from how Webcomic uses the url_to_postid() function. The next release should include a fix for this.
Oh, that’s great news, Mike! Thanks so much :)
I was just wondering about the status on this. My individual comic posts follow the themes I’ve associated with those collections, but the “about” pages and archive pages for those collections still use the general inkblot child theme that I’m using for the rest of the site. I tried jhicks’ advice with the webcomic_collection field and webcomic_term value but had no luck with it. Thanks.
http://comics.chromedomestudios.com