I am trying to utilize a switch statement inside the worpdpress loop to alter classes on the div, however the incrementing counter ($IntCounter) does not appear to become firing inside the loop:

<?php
global $intCounter;
$intcounter = 0;
query_posts('category_name=clients&posts_per_page=3&tag=new-work');
if(have_posts()) : while(have_posts()) : the_post(); 
        $intcounter++;
        switch ($intcounter){
            case 1:
                $ThisPostCSSClass ="new-work-post span-7 colborder ";
                break;
            case 2:
                $ThisPostCSSClass ="new-work-post span-8 colborder ";
                break;
            case 3:
                $ThisPostCSSClass ="new-work-post span-7 last";
                break;
            default:{
                $ThisPostCSSClass="noclass";
            }

        }

    ?>
<div class="<?php echo $ThisPostCSSClass;?>" id="<?php the_ID(); ?>">
    <div class="">
    <?php the_content(); ?>
        <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
    <?php the_excerpt(); ?>
    </div>
</div> <!-- .post -->
    <?php endwhile;endif; ?>

Shall We Be Held missing something apparent? Thanks

Don't use ":" for the stamentlists, but use Curly brackets .

Eg:

if(have_posts()) {
   while(have_posts()) {
       the_post(); 
       $intcounter++;
       switch ($intcounter){
           case 1:
             ...
             ...
       }
   }
}

You have a capital C inside your global $intCounter but you're incrementing and switching on $intcounter. This initializes 2 variables. The switch statement and loop works fine otherwise.

Why branches around default, but for the switch, although not for that if nor the while? Helps make the code harder to see. Also unsure why you are utilizing a global for $intcounter (which btw includes a C rather than a c), unless of course there is a reason for your which i have no idea. Apart from that appears it should work.

I've got a feeling it has something related to your use of global. Normally it's used inside a scope to inform it that you would like to make use of the globally defined version from the variable and never the neighborhood one.

I went ahead and redid the dwelling from the code blocks (for appearance, please humor me) with curly braces and removed the worldwide keyword. Try giving this chunk an attempt and find out whether it matches your needs:

<?php

query_posts('category_name=clients&posts_per_page=3&tag=new-work');

if(have_posts()) {
    $intcounter = 0; // Moved this to within the IF block

    while(have_posts()){
        // If you did want to use the "global" keyword, you'd probably use it here:
        // global $intcounter;

        the_post(); 
        $intcounter++;

        switch ($intcounter){
            case 1:
                $ThisPostCSSClass ="new-work-post span-7 colborder ";
                break;
            case 2:
                $ThisPostCSSClass ="new-work-post span-8 colborder ";
                break;
            case 3:
                $ThisPostCSSClass ="new-work-post span-7 last";
                break;
            default:  // Curly braces not required here.
                $ThisPostCSSClass="noclass";
        } // Switch

?>
<div class="<?php echo $ThisPostCSSClass;?>" id="<?php the_ID(); ?>">
    <div class="">
    <?php the_content(); ?>
        <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
    <?php the_excerpt(); ?>
    </div>
</div> <!-- .post -->
<?php

    } // While

} // If
?>

you're getting the worldwide $intCounter; but setting and incrementing $intcounter; Unsure this is actually the problem because you are initializing $intcounter=0; and incrementing it properly. Which means this only means the global $intCounter; is unnecessary.