Wordpress/PHP question. I'm working on a Wordpress theme and want to use an algorithm to alter some of the HTML it emits. I've got a general idea of how to do this, and could probably manage a brutish implementation on my own, but my PHP-fu is weak and there is probably a better way.
Here's what's going on. I'm using the
blueprint css approach for a gridded layout. And I've got a "bottom-bar" of widgets, laid out in three columns. With blueprint css, the div for the third column needs
class="last" added to it in (in addition to class declarations that apply to all divs) order for everything to line up right.
What I want to do is get the count of widgets each time a widget is emitted, and if count mod 3 = 0, insert 'last' into the class. Barring that, if I could insert
class="widget-N" (where N=count) in all divs, I could manage, although it would be less elegant. Ideally, all browsers would magically support CSS3 and obviate this problem, but I'm not holding my breath.
Obviously I don't want to touch the core code. I don't mind inserting an altered version of whatever function is necessary into my functions.php file; but if there's a callback that lets me avoid doing that, so much the better.
$last = ($i % 3) ? '' : 'last';
echo "class=\"widget $last\"";
}
Should do it. No idea where to stick it, though.>
posted by Leon at 6:49 AM on June 30, 2008