You are currently viewing

Hacking the WP-Imagefit Plugin

It’s actually surprisingly easy to make work with non-hAtom-based themes (i.e. the Default theme).

How do I do it then?

First things first, ensure your posts are wrapped in a block element that has a class, for instance the Default theme wraps each post in a <div class="post">.

Open wp-imagefit.php and on line 20, change:

jQuery('.hentry').imagefit();\n to jQuery('.post').imagefit();\n

Obviously replace .post with the class you used in your HTML. I’ve only tested this on a custom theme and the Default theme but it seems to work fine for me.

Hope it helps other people.

Alternatively, if you’d rather edit your theme than the plugin, simply edit your theme templates to wrap each post in a <div class="hentry">

Sidenote to plugin author

Excellent plugin, thank you for making it. At some point you could rewrite this so that the plugin automatically injects a <div class="imagefit"> around each entry in the loop, then call that class in the jQuery instead. Limiting this to hAtom only themes seems unneccesary to me.

Link: http://wordpress.org/extend/plugins/wp-imagefit/

This entry was posted on Wednesday, February 27th, 2008 at 2:17 pm and is filed under Blog, CSS, JavaScript, WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Post A Reply

Feel free to leave any comments here