Theme update and a mad dash to fix broken stuff

So Museum Core was pushed live to the repo today. Of course I immediately switched my blog from the Twenty Fourteen theme I was testing to Core because, you know, it’s my freaking theme. And immediately I ran into some issues. If you are using Core and experience any of these, here are the fixes. Also, if you’re using Core and you find new issues, be sure and let me know in the comments or in the theme’s support forum.

Notifications appear twice

I’m also using my Notifications plugin. I thought I was clever by adding support for multiple possible action hooks in the plugin. Maybe I was. However, I was also a bit too clever in adding support for multiple possible action hooks in the theme. This resulted in both the body_open action and the before action being found by the theme in the Notifications plugin and resulted in the notifications displaying twice. That’s not good. I guess I was being a bit too clever.

I pushed out an update to the Notifications plugin that removes support for the body_open and before actions (effectively removing the native support for Twentytwelve that I added) in favor of the Theme Hook Alliance tha_body_top action. In theory at least, the Theme Hook Alliance actions will become more canonical and used by multiple themes so, while I’m removing native support for Twentytwelve, I’m actually adding support for any of the themes that currently do support THA hooks and Twentytwelve, if the theme authors decide to add THA hooks into it. If you are using Core and Notifications together, please update your action hook under the <body> to this:

<?php do_action( 'tha_body_top' ); ?>

Icons don’t display

Museum Core 2.0 removes all the image icons that were previously in the theme and replaces them with the icon font, FontAwesome. FontAwesome is — as it sounds — awesome, and using it with the Bootstrap 3.0 support that is the foundation of Museum Core was a pretty easy decision. However, after updating my theme, none of the icons (which appear at the bottom of the posts) were displaying. I thought there was some caching issue or maybe the font files never downloaded in the update. But, checking all that, came up empty. Finally, I found the issue.

I’m also using the Better WordPress Minify plugin, which minifies all your javascript and css. Well the FontAwesome CSS is already minified, so I suspect that trying to concatenate and re-minify an already minified CSS file made something go wonky and it just wasn’t working at all. The solution was to turn off CSS minification and everything works fine now.

(By the way, that cool little flag thingie up there, that was created using FontAwesome using a recipe from their site…here’s the code:)

<span class="icon-stack pull-left icon-4x"><i class="icon-circle icon-stack-base"></i><i class="icon-flag icon-dark"></i></span>

(Note, if you do this in WordPress, you’ll need to put all the code on a single line, no breaks — otherwise the WordPress editor will interpret those as line breaks (<br />) and it will break the cool stacking effect. Also note that I’m using icon-dark on the flag instead of icon-light as is suggested here since the font color is already light.)

Download Musuem Core!

Now that I’m done with my rant, please, please PLEASE go download Museum Core RTFN and tell me what you think. I tried to make it as flexible as humanly possible and I’m pretty satisfied that the result is something that’s both usable as a theme framework or a theme that allows you to tweak almost every aspect of it right from the Theme Customizer. Again, if you run into any issues, please let me know.

WordPress, Genericons, Jetpack and you

Here’s something I learned the hard way today.

If you are using Genericons in your WordPress theme, and you’re enqueueing it like this:

wp_enqueue_style( 'genericons' );

…you’re going to run into problems if Jetpack is enabled, because Jetpack uses the same method. Normally this wouldn’t be that much of an issue, but their version of the Genericons font is older and doesn’t include some of the newer icons — which will just be missing if you’re using the Jetpack version. So, to resolve this, you’ll need to make your Genericons handle more unique, e.g.

wp_enqueue_style( 'mytheme-genericons' );


This has officially been fixed and will be resolved in the next Jetpack release. There’s also a discussion over here about possibly including Genericons in core, which I wholeheartedly support. Thanks George and Jeremy for being so on top of things that they happened to notice my little blog post out in the middle of Nowhere, Blogosphere USA.

Developing for a greater cause

So, for a number of years, I’ve had a sort of rule: “don’t do work for free.”

There are a number of caveats to this. Doing stuff for myself or my own projects would technically be working for free, but maybe I’m doing it to figure out how to do a new thing in WordPress or development in general or maybe this is for one of my business sites (so, ultimately — we hope — would lead to cash and not working for free). This is purely an economic thing — doing work for free means I don’t get paid (obviously) — and since I work primarily for myself, not getting paid is Kind Of A Big Deal. Ideally all my side projects will ultimately lead to paid work, even if it’s a matter of building experience and becoming a better developer.

That’s how my Cat Signal plugin started out. It was something that no one else had done yet and I did it for myself and to play more with the Settings API and validation best practices and trying to make myself sure that I am _doing_it_right() in terms of writing good WordPress code. When it was done, and still no one else had done it yet, and people started to download it, I thought, “huh, well, maybe it would be a good idea to let the Internet Defense League know that I did this, and they can maybe post a link to it on their site or whatever.” I’d like to take a second to point out that they never contacted me to do this plugin (they probably wouldn’t know me to contact me and presumably they didn’t contact anybody). This plugin was built organically out of a need to have a plugin to run the javascript for the IDL alerts without having to hack your theme and lose that stuff next time there’s a campaign.

Since then, I’ve been contacted by some folks at the IDL and invited to join their developer Google Group (though it’s open to non-devs as well) and have learned that not only are they actively promoting the plugin for their WordPress users to test it out in advance of a campaign that’s coming up, but that there’s this wider world of people who I wasn’t developing for because I built this originally for myself. And this is what every developer wants, right? You write code you think is useful and hope that other people find it useful, too. But even better than that is to be promoting a cause, and the Internet Defense League is a cause.

In my experience, causes tend not to pay very well. In fact, coding for causes has, historically, sucked. That’s speaking from a web designer standpoint where I’m building a site for a non-profit who really doesn’t have a lot of funds to pay for the work they need done. But there’s really only so much of that that you can do before you go broke, right? You can’t make a living working for free. For my part, this wider audience for the Cat Signal plugin has a) made me aware of a stupid oops I left in the code b) made me aware of a way to test whether the script was installed correctly that I didn’t know about and c) showed me some areas where I could improve the plugin. Which goes back to the original intent of doing this to increase my knowledge and skills and I learned a new php function (is_numeric()) in the process.

This morning I responded to a forum post in the Cat Signal support forums about what else can be done to impact the cause (or causes) which led me to write a pseudo-philosophical/political/ideological response about activism, awareness, social engineering and education. In a WordPress support forum. I’ve been involved in activist groups in the past and it all comes back to making people aware that there’s something worth caring about.  Which is what the plugin and the IDL Cat Signal does. It’s not going to force the issue if it’s not going to be forced, and it’s not the same as donating cash, which is always the best way to help these causes and activist groups. But talking about civic responsibility (yes, I went there) and how every individual is responsible for doing their part in a democratic system if you don’t agree with something that’s going on made me happy to be contributing in my small part to a wider cause that reflects how I look at the world sans actually getting paid.  (Although, getting paid for this would be even more awesome. Just sayin‘. *cough*)

Search Engine Optimized breadcrumbs

I had a need to build some search engine optimized breadcrumbs for a project I’m working on right now.  I didn’t want to just use Yoast’s breadcrumbs, because I’m using Twitter Bootstrap, and I wanted to make use of the built-in breadcrumbs support, so I did a Google, found something, tweaked it and am using it on this project.  I wanted it to support both page and blog post hierarchy, the original source did not support page hierarchy, just post categories.  Everything works automagically, all you need to do is use the seo_breadcrumbs() php function.

Here are some screenshots of it in action:

Breadcrumbs in a post, when a page has been set for blog posts (other than the Home page)

Breadcrumbs in a post, when no page has been set for blog posts (default Reading setting)

Breadcrumbs in a page, when the page has a parent

Breadcrumbs in a page, when there is no parent page

Here’s the code: