I have just committed a major update to my K2 Hook Up plugin. As soon as I released my plugin—which allows smart people using the K2 theme to insert arbitrary HTML, CSS, or JavaScript code into any of the 7 custom template hooks that K2 provides—I got the same question: When will it support inserting PHP code?
I’m happy to report that its day has come, and that day is today.
As of version 1.0, the plugin supports adding any mix of HTML, CSS, JavaScript or PHP into the settings box. To minimize issues caused the use of eval(), I force the user to turn on PHP support separatley for each hook. That way, if you’re only going to be putting happy markup in the box, I’ll skip the eval step when printing your code to the screen.
This opens up a world of possibilities to your theme, as you can now essentially add anything to your theme, without breaking your K2 upgrade path, including WordPress template tags or snippets from other plugins. Its a beautiful thing.
However, be forewarned that any PHP code you do insert must be wrapped in proper PHP tags, and must be syntactically correct. If your code produces an error, nothing will be output to that hook (though your blog should keep on chugging and not miss a beat).
K2 Hook Up v1.0 also brings a few UI enhancements, including the awesome textarea resizer, which should be familiar to Drupal users. In addition, I filed the settings page under the Design tab, next to the other K2 options, as that seemed more logical than where I was stashing it (under Settings).
0 Response to “K2 Hook Up v1.0”