</a>
             <?php 
        }
        ?>
             <?php 
        if (has_post_thumbnail() or $key_1_value != '') {
            ?>
             <div class="blog-date">
             <?php 
        } else {
            ?>
             <div class="blog-date-noimg">
             <?php 
        }
        ?>
                <span class="date"><?php 
        the_time('M');
        ?>
<br /><?php 
        the_time('d');
        ?>
</span>
                <div class="plove"><?php 
        if (function_exists('heart_love')) {
            heart_love();
        }
        ?>
</div>
             </div>
        </div>
         <div class="blog-content">
                <?php 
        echo field_input('alltab', $block_id, $alltab, $size = 'full');
        ?>
            </label>
        </p>
         <p class="description">
            <label for="<?php 
        echo $this->get_field_id('tabbed');
        ?>
">
              <?php 
        _e("Display without tabs &nbsp;&nbsp;", 'oblivion');
        ?>
                <?php 
        echo field_checkbox('tabbed', $block_id, $tabbed, $check = 'true');
        ?>
            </label>
        </p>
        <?php 
    }
    function pbblock($instance)
    {
        extract($instance);
        ?>
        <?php 
        if ($projnum == '') {
            $projnum = -1;
        }
        ?>
     	<?php 
        if ($tabbed) {
            ?>
       <div class="portfolio-block block">
           <?php 
            if ($title) {
                echo '<h3>' . strip_tags($title) . '</h3>';
            } else {
                echo '<h3>Portfolio</h3>';
            }
            ?>
          <ul id="list" class="portfolio-grid span12">
               <?php 
            $myArray = explode(',', $categories);
            $args = array('taxonomy' => 'portfolio', 'exclude' => $myArray, 'hide_empty' => true);
            $terms = get_terms('portfolio-category', $args);
            foreach ($terms as $term) {
                $termsarray[] = $term->term_id;
            }
            $post_ids = get_objects_in_term($termsarray, 'portfolio-category');
            ?>
                <?php 
            query_posts(array('post_type' => 'portfolio', 'posts_per_page' => $projnum, 'post__in' => $post_ids));
            ?>
                 <?php 
            $i = 0;
            ?>
                <?php 
            if (have_posts()) {
                while (have_posts()) {
                    the_post();
                    ?>
                     <li data-id="id-<?php 
                    echo $i;
                    ?>
" class="span3 <?php 
                    global $post;
                    $terms = get_the_terms($post->ID, 'portfolio-category');
                    foreach ($terms as $term) {
                        echo substr($term->name, 0, 4);
                        echo ' ';
                    }
                    ?>
">
                    <div class="pimage">
                        <div class="pbg"></div>
                        <div class="pdisplay">
                            <a href=" <?php 
                    $image_id = get_post_thumbnail_id();
                    $image_url = wp_get_attachment_image_src($image_id, 'full', true);
                    echo $image_url[0];
                    ?>
" class="vimage shadowbox">View image</a>
                            <a class="minfo" href="<?php 
                    the_permalink();
                    ?>
">More info</a>
                        </div>
                       <?php 
                    the_post_thumbnail(array(287, 222));
                    ?>
                    </div>
                    <div class="ptitle">
                        <h4><a href="<?php 
                    the_permalink();
                    ?>
" rel="bookmark" title="Permanent Link to <?php 
                    the_title_attribute();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h4>
                        <span><?php 
                    the_time('jS F Y');
                    ?>
</span>
                    </div>
                      <div class="plove"><?php 
                    if (function_exists('heart_love')) {
                        heart_love();
                    }
                    ?>
</div>
                </li>
                 <?php 
                    $i++;
                }
            }
            ?>
                 <?php 
            wp_reset_query();
            ?>
          </ul>
          <div class="clear"></div>
        </div><!-- portfolio-block block -->
     	<?php 
        } else {
            ?>
     		<div class="portfolio-block block">
           <?php 
            if ($title) {
                echo '<h3>' . strip_tags($title) . '</h3>';
            } else {
                echo '<h3>Portfolio</h3>';
            }
            ?>
            <ul class="splitter">
                 <li class="segment-1 selected-1"><a data-value="all" href="#"><?php 
            if ($alltab) {
                echo strip_tags($alltab);
            } else {
                echo __('Everything', 'oblivion');
            }
            ?>
</a></li>
                 <?php 
            $myArray = explode(',', $categories);
            $post_ids = get_objects_in_term($myArray, 'portfolio-category');
            $args = array('taxonomy' => 'portfolio', 'exclude' => $myArray, 'hide_empty' => true, 'post__not_in' => $post_ids);
            $terms = get_terms('portfolio-category', $args);
            $count = count($terms);
            $i = 0;
            if ($count > 0) {
                foreach ($terms as $term) {
                    $i++;
                    echo '<li class="segment-0"><a href="#" data-value="' . substr($term->name, 0, 4) . '" >' . $term->name . '</a></li>';
                }
            }
            ?>
            </ul>
              <ul class="portfolio-grid span12" id="list">
				<?php 
            foreach ($terms as $term) {
                $termsarray[] = $term->term_id;
            }
            $post_ids = get_objects_in_term($termsarray, 'portfolio-category');
            ?>
                <?php 
            query_posts(array('post_type' => 'portfolio', 'posts_per_page' => $projnum, 'post__in' => $post_ids));
            ?>
                 <?php 
            $i = 0;
            ?>
                <?php 
            if (have_posts()) {
                while (have_posts()) {
                    the_post();
                    ?>
                     <li data-id="id-<?php 
                    echo $i;
                    ?>
" class="span3 <?php 
                    global $post;
                    $terms = get_the_terms($post->ID, 'portfolio-category');
                    foreach ($terms as $term) {
                        echo substr($term->name, 0, 4);
                        echo ' ';
                    }
                    ?>
">
                    <div class="pimage">
                        <div class="pbg"></div>