<?php get_header(); ?>
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post-body pages">        
<?php get_sidebar('left'); ?> 
<div class="posts-wrap three_col"> 
   <? //print_r($post)?>
<div class="post" id="page">
		
		<h2 class="page-title">
                <?php if($post->post_parent!=0){ ?>
                  <!-- <span><?php echo get_the_title($post->post_parent); ?> </span> -->
            <?php } ?>
            <?php the_title(); ?>
        </h2>

			<div class="entry-content" id="page-content">
			
				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>

				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
			</div><!-- end #page-content -->

	</div><!-- end #page -->
    
<?php  global $category_id;
           $category_id = get_post_meta($post->ID, 'category_id', true); ?> 
                 <?php $category_id2 = get_post_meta($post->ID, 'category_id2', true); ?> 

                 <?php if($category_id2){
                            if($category_id){
                                $category_id .= ",$category_id2"; 
                            }else{
                                $category_id .= "$category_id2"; 
                            }  
                       } ?>
                <?php if($category_id):?>
                 <?php $args = array( 'numberposts' => get_option('posts_per_page'),'cat'=>"$category_id" );
                      $pageposts = get_posts( $args );?>
                 <?php //echo count($pageposts); ?>
                    <?php if($pageposts):?>
                        <?php $count_post = count($pageposts);
                              $row_status = 1;
                              $count_row = 1; 
                        ?>
                        <div class="cat_static_blocks">
                        <?php foreach ($pageposts as $post): ?>
                        <?php setup_postdata($post); //print_r($post);?>
                            <?php $last_text = '';  if($row_status == $count_post) $last_text = 'last'; ?>
                            <div class="left static_blocks">
                                   <h2> <span><?php echo get_the_title($post->ID); ?></span> </h2>
                                   <div class="left thumbnail">
                                        <img src="<? echo get_Image_url($post->ID,'s','thumbnail');?>"  width="150" alt=""><br>
                                        <a href="<?php echo get_permalink( $post->ID ); ?> " class="static_blocks_link">Read more</a> 
                                   </div>
                                   <div class="left text_static_blocks">
                                        <p>
                                             <?php the_excerpt(); ?>  
                                        </p>  <br>
                                        
                                   </div>
                            </div>
                        <?php $count_row +=1;
                              if($count_row>2){echo '<div class="clear line"></div>'; $count_row = 1;}   ?>
                        
                        <?php endforeach; ?>
                        </div>
                    <?php endif; ?> 
                 <?php endif; ?>       
                       
                       
    
			<?php endwhile; endif; ?>
            
	<?php edit_post_link( __('Edit this page', 'blank'), '<p>', '</p>'); ?>
 </div><!-- end .posts-wrap -->
	
<?php get_sidebar('right'); ?>
</div>
<?php get_footer('all'); ?>