More-Than-Zebra style wordpress loop

to start, i would like to express my thanks and gratitude to all the volunteers in the wordpress forum who patiently and freely give their time and attention, and share their knowledge and experience with all the users coming with questions and problems about their wordpress installation and modifications.
a great community.

lists or posts styled with alternating color backgrounds, for instance, can inprove the readability of blogs.

most themes and the standard wordpress installation are not offering this feature.
however, it is easy to implement, when you know how.

for example we could give alternating posts within the ‘wordpress loop’ a different extra class (‘odd’ or ‘even’) which can then be used with css.
to begin with, we introduce a counter ($c = 0;) before the loop, increment it inside the loop ($c++), and generate a class depending on the number of the counter by checking the modulus 2 of the number ($c % 2 – modulus is the remainder of the division):

<?php $c = 0 ; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $c++;
if( $c % 2 == 0 ) $extra_class = ' even';
else $extra_class = ' odd'; ?>
<div class="post <?php echo $extra_class; ?>">
<!--typical stuff in the loop-->
<?php endwhile; ?>
<?php else : endif; ?>

the class ‘odd’ or ‘even’ can be used in the style.css to create different background colors, alignments, margins, paddings, font-styles – no limits.

the most basic application of this method with a counter is how to style the first post in the loop different (only showing the logic part of the code):

<?php $c++;
if( $c == 1 ) $extra_class = ' first';
else $extra_class = ''; ?>

to make it more interesting, the next example is to create three different styles and a special style for the last post on the page.
we can get the number of the last post with


The structure is the same, the main difference is in the ‘if, elseif, else’ logic:

<?php $c++;
if( $c == $wp_query->post_count ) $extra_class = ' last';
elseif( $c % 3 == 0 ) $extra_class = ' three';
elseif( $c % 3 == 2 ) $extra_class = ' two';
elseif( $c % 3 == 1 ) $extra_class = ' one';

you can extend this method to create any number of cyclic classes.

EDIT: a new way of adding any number of recursive css classes – without counter variable, using the $wp_query->current_post of a default loop:

$extra_classes = array('one','two','three','four','five');
$extra_class = $extra_classes[$wp_query->current_post%count($extra_classes)];
echo $extra_class;


and you can use it in any situation in your wordpress templates, where you loop through some output – lists, foreach, for, while, posts, comments, …

special thanks to @esmi who dared venturing into the realm of more than two alternating styles, and who inspired me to post this article.

WP Kubrick default theme in 3 columns

Part of my time, I am spending designing and troubleshooting wordpress themes.

3 column kubrick theme

This is my latest ‘hack’, turning the default theme that comes with every wordpress installation, into a 3 column version, with equal sized left and right sidebar columns, all dynamic and widget ready.

All functions of the default theme are fully preserved. You can still modify the header colours from within the dashboard.

All files and graphics zipped for download. A great start for learning to mod your own theme.

At last a ‘default’ wordpress theme that fills the width of my laptop’s monitor 😉

Update: horizontal page navigation below the header included.

To activate it, edit header.php and  remove the commenting where indicated.

Water Filter Benefits

All processes within your cells are depending on water in one way or another. Also, your bodies are made to two-thirds out of water. So, it is no wonder that you depend on a constant supply of drinking water, and that dehydration can cause all sorts of illnesses or diseases, or can make you feel bad.
Drinking enough clean pure water
every day is so important to your health that one doctor wrote a whole book about it: ‘Your Body’s Many Cries for Water’ by Dr. F. Batmaghelidj.

Disclaimer: This article is not designed to provide medical advice or professional services. It is intended to be for educational use only. The information provided in this article is not a substitute for professional care and should not be used for diagnosing or treating a health problem or a disease. If you have, or suspect you may have, a health problem you should consult your doctor.

And obviously the quality and purity of your drinking water is of highest importance. You can imagine that drinking polluted water is not going to help your body to improve its health. I am going to emphasize the benefits of drinking pure or – as it is in reality – of purified filtered water by pointing out the negative health impact of common contaminants in tap water. Although water companies are regulated and have to control the quality of the water they supply to your home, there are limits in how the water companies have to treat the tap water, resulting in residual contamination. Continue reading “Water Filter Benefits”

Layers to Enlightenment

SHREK: No! Layers! Onions have layers. Ogres have layers. Onions have layers. You get it? We both have layers.

onionsThe obstacles that separate us from enlightenment also form layers of various energetic composition – and have to be dealt with individually with specialized methods – there is no panacea!

If you have read ‘The Four Agreements’ by Don Miguel Ruiz, you might know that your reactions are guided by the way you agreed, at a very early age, to certain pattern and conditioning by those whom you trusted to be superior to yourself.
Every single one of these agreements forms a layer.

Every time we make one of these agreements, it removes us further away from who we really are. As we grow older, these agreements form layer after layer after layer ….

Each of these layers can have very different ‘energy’ to it.

To make my point clear, let me go over to the physical world and compare this to archaeology – some ancient artifact is covered by different layers of debris, mud, slime, hard crusts, rubbish, concrete, more slime, scrap metal, compost, gravel, ………

To get that cleared and removed to get to the core, the ancient artefact, you would need to use more than one single method – particular as you don’t want to risk and damage the core.

You would start with a heavy excavator to remove the rubble, then use a pick-axe and spade, and the little trowels. You can then investigate what you have unearthed, and try to make sense of it. If you are satisfied with your explanation, this layer is no longer of any interest to you, and you proceed with the next one.

The next layer can have a totally different structure and composition.

( more to come …
– – – work in progress )