K2 Hook Up

The K2 theme provides a number of additional hooks into the template. If you’re handy with PHP you can easily add any manner of arbitrary content to these 10 regions. For everyone else, there is K2 Hook Up.

This plugin provides an options screen with each unique hook exposed as a simple text box. Insert any HTML, CSS, or JavaScript that you like, and click submit and it will be instantly published to that region of your template.

Download K2 Hook Up Plugin

Which Hooks are available?

Body Top
Right after the opening <body> tag
Before Header
between the <div id=”page”> and <div id=”header”> blocks
Below the <p class=”description”> block
Header Menu
Inside the <ul class=”menu”> block. Use this one to add <li> items to your navigation
Before Content
Before all of the content in <div class=”content”> (this includes the sidebars)
Primary Begin
Before the Rolling Archives block (and after the notices div)
Primary End
After the dynamic content (and before the closing tag for the primary div)
After Content
After all of the content in <div class=”content”>
Before Footer
Before the start of the <div id=”footer”> block
Inside the <div id=”footer”> block, before the powered by links

For more info, and to see how the hooks are integrated into the mark up, check out the K2 CSS and Custom CSS wiki.

74 thoughts on “K2 Hook Up

  1. Using WordPress 2.6.3. and K2 RC-7

    I keep getting:
    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, ‘flaresmith_load_translation’ was given in /home/fruity/public_html/wp-includes/plugin.php on line 311

  2. I activated your plugin and got this:
    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘flaresmith_load_translation’ was given in /home/twenty/public_html/wp-includes/plugin.php on line 311

    I am very eager to start using this, it is exactly what I have been looking for!

  3. fruityoaty,

    That’ll teach me to copy code from another plugin! I just committed a fix for this as v0.6. Upgrade to that, and you’ll be fine. It should happen semi-automatically since you’re using WP 2.6.3.

    Thanks for pointing that out!

    - Eric Marden

  4. Thanks, Bensan.

    I’m going to be adding php support to K2 Hook Up later today, which will further blow the doors off this great theme.

    I have another plugin I’m starting to draw up plans for, that will require being able to print out WordPress template tags in the hooks that this plugin targets, so the two will go hand in hand once they are both finished.

    Stay tuned,

    - Eric

  5. Pingback: K2 Hook Up v1.0 | xentek

  6. Pingback: WordPress Plugin Releases for 11/27 | Wordpress Blog NL

  7. Pingback: WordPress Plugin Releases for 11/28 | hieudt's blog

  8. Pingback: Quasi.dot

  9. Pingback: WordPress Plugin Updates for 11/27 | Zack Live

  10. How do you get rid of the 2 post titles that show up above and/or below the single post entries without screwing anything up? Is it in the single.php file?

  11. Pingback: Thesis OpenHook — Kingdom Geek

  12. Eric,

    I’m not talking about double titles, I’m referring to the titles that link to other posts and appear in smaller font above the single page titles

  13. You can do that with CSS. Put this in your custom style sheet:

    .nav-previous, .nav-next {
    display: none;

    This will just hide the links. You can also target the id: #nav-above and #nav-below and hide the whole containing box too.

    Let me know if you need more help than that.


  14. Hello Eric, I would like to wrap some of my sidebar widgets into divs for css styling – is there a wp or k2 hook that I can use?

    (I am currently hacking k2.php to get it done but I would like to use a functions.php file in my k2 style’s directory instead)

  15. Btree,

    I can’t think of any hooks that would be useful in this regard, but there still may be a solution. The sidebars are wrapped in divs that can be styled pretty easily. What are you trying to do that you need more divs for?


  16. Hi there,

    I’m using WordPress 2.7 and K2 RC-7 and it works beautifully. I’ve been looking for something like this for a while. I’ve already started to ‘pimp up’ my website with your plugin. Amazing work by the way! I’m amazed I can now tweak my themes without worrying about the upgrade to a new K2 or a new wordpress. Cheers and keep up the good work!

  17. Pingback: Thesis OpenHook — Kingdom Geekery

  18. Pingback: 27 WordPress Plugins I Have Installed | Bill Bolmeier

  19. Is is possible to add edit in place via flutter plugin with the k2 hooks plugin? I need to add : <h2 class=”"> And :
    <div class=”">

    to theLoop.php i think…

    • I’m looking at Flutter now and not seeing any special documentation for enabling edit-in-place.

      However, if you need to get something into the loop, I have another plugin which may do the trick: In The Loop.


  20. I think your plugin is awesome because it prevents modifying K2 files with every update of the theme. The only thing I think it should be added is a hook for adding html tags “Before Body”, right at head tag.

    If I want to add a favicon code for example, it can be done after the body tag, but it’s not HTML compliant, so the only way to do it is inside the head tag.

    Can it be done??

    • K2 Hook Up uses the hooks that K2 publishes inside its theme, so to do it exactly as you are suggesting would require adding a new hook (and hence modifying the theme files). There is wp_head that I could target as well for this, but for favicons, I usually use this plugin: Favicon Manager. You may already have one, but I wrote a tutorial on creating favicon.ico files from PNGs recently that you may be interested in, too.


  21. Hi there,

    I just installed your plugin and added a couple of hooks, one in the header and one at the bottom before the footer. Nothing is showing up.

    The one on the header is a (adsense google add) that’s been in use in all my posts, I just put it in the header to see if it works but I could not get it to work.

    the one (before the footer) is just a simple html code that is also in one of the wdigets for a link to a page on my site (tasty cooking) link. you can see it on top of the side bar.

    just wondering if I did anything wrong, it seems fool proof that there is not much I can do wrong, put the script in the windows and update????

  22. Eric,

    I am not sure I understand your comment??? in my admin area it tells me that I have (k2 hook up version 1.1.1)

    I just installed this plugin today, there is no other versions???

      • AHH,

        Now I think I understand, I thought your were asking for k2 hooks version, you are asking for the k2 theme. So K2 hooks only work with k2 themes, if so then that explains why it’s not working. I don’t have a k2 theme.

        I thought this is just a plugin that would work with wordpress independent of the theme.

        thank you

    • K2 is more of a theme framework, but can be easily customized via CSS and the built in Theme Options and includes many other features non-developers seem to get a lot of mileage out of.

      You can learn more about it here: http://getk2.com

      Check out In the Loop for a similar plugin of mine that does work with any theme.

  23. Is there a way to make the coding on the header for the navigation drop lower? For instance on this site http://www.maverickmlmcoach.com I need the navigation to be a step lower so it is not so crushed up against the header. Also where do I go in the coding to add another link to the navigation bar as I cannot find this piece of coding anywhere.

    Thank you.


    • You’ll want to create a child theme to take care of these issues. The basics are explained on the K2 Wiki.

      You can manage the placement of the navigation by using CSS. Take a look at the defaults in k2/style.css for ul.menu, then tweak as you see fit in your child theme’s style.css style sheet.

      As for adding a link, what you’ll need to do is copy k2/blocks/k2-header.php to your child theme in the same ‘location’ (i.e. blocks/k2-header.php). Any changes you make in your child theme copy will override those in k2′s copy (this is how child themes work). It should be relatively obvious what you’ll need to change, but like the styles, start with the default code and change just what you need to get it the way you want it.


  24. Just installed the K2 Hook Up plugin version 1.4. I have k2 rc8. When I press the Configure Settings link I get “No input file specified. “. My child theme is my_k2. I have a copy of blocks/k2-header.php under my_k2. In fact, I have a complete copy of blocks under my_k2.
    Do I have to specify an input file? Where?

    • The link in on the plugin list was just broken. The Options Page for K2 Hook Up can be found under the “Appearance” section of wp-admin. I have just submitted a fix for this link to the plugin repository, and you should be notified of the update shortly via WordPress’s auto-update feature.

      Thanks for telling me about this bug.


  25. Hi author, I want translate your plugin to russian language. Please tell me Your email, simply reply me to email. Thanks

  26. I have asked this question on the K2 support forum…
    I am using K2 v1.02 on a self hosted WordPress blog and I want to be
    able to insert Google ads between posts on my WordPress blog
    http://www.osd-uk.com/protoolsformedia as I had on my Blogspot blog

    I found a guide that would appear to do this at…


    and the first thing they ask is to insert
    immediately before on the Index Template
    page in the theme editor. However I cannot find in the K2 theme editor!

    How can I insert ads between my posts in K2.

    Someone recommended your plug-in which looks as if it can do what I want. But my question is which point do I put the Google Adsense code so an ad appears between posts and I would prefer an ad didn’t appear between every post. There is a setting on Blogspot sites that restrict the ads to no more than 3 on a page and I would like to mirror something similar on my WordPress blog.



    • Mike,

      You’d have to employ a bit of Custom PHP to make this work, and would probably be easier to accomplish in a K2 child theme, so you can over ride it at the template level. Doing this would probably obviate the need for my plugin.

  27. It doesn’t seem that template_primary_end (what I need) works. I’m running WordPress 2.9.1, K2 1.0.2, and K2 Hookup 1.5.1.

    template_primary_end appears to be missing from single.php, possibly others.

    Am I missing something?

  28. Pingback: Wordpress Plugins I Like

  29. Hi,

    I’ve inserted my header using the K2 hook up plugin but it is only showing up properly on my main page (www.ladyatelier.com), otherwise there’s a ? icon in place of the header on subsequent pages. What could be the problem?

  30. Hi,

    I was wondering whether there are any issues with using this on a multi user system? I have been tasked with allowing our blog users to add individual custom text to their blog footers. Now, you’d think the easy way for me to find this out would be to install and test it on our system right? Unfortunately, the slow, somewhat rusty, wheels of the bureaucracy here won’t let me do that and they want to know whether the functionality exists before they install the plugin (don’t look at me, I have to work with this!). I have installed and tried it on my own personal blog and it’s a fine piece of work.

    Can you tell me whether k2-hook-up will allow custom content on a per-user basis?


    • I’m pretty sure I tested it on MU (don’t remember), so it should work fine. The content is stored in the options table, and each blog has their own options table in MU, so each blog should have its own version of what goes in the k2 hook up fields. If it doesn’t work, let me know and I will fix it for you.

    • The plugin will work fine; however, if you do not explicitely trust your users, then you’re opening yourself up to a security nightmare. Any files accessible to the PHP user can be accessed, meaning someone could easily display the contents of your wp-config.php file from within Hook Up. Likewise, they could run an SQL command and wipe your database… or various other bad things.

      So yes, you can use Hook Up on a multiuser system, but do so fully aware of the risks.

      • Good Point, Rick! I added the PHP ability, knowing that it gave users more power than they needed (but some had requested), so keep that in mind when rolling this out to other users. Indeed, I may need to tighten this up by limiting PHP ability to admin users only or something.

        • That’s really helpful guys, thanks. The security thing won’t be an issue in this context, but it’s good to be aware of such things.

  31. Pingback: WordPress Plugins that stand the Test of Time | Ryan Price and the Media

  32. Pingback: Thesis OpenHook | WordPress Designer

  33. Pingback: Thesis OpenHook | Wbcom Designs | WordPress Developer

  34. Pingback: Making Your Web Site Function with WP Plugins- Media Marketing Management

  35. Pingback: The OpenHook Customizations Manager | Best Plugins - wordpress – widgets – plugin 2012

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>