1. <?php global $data; ?>
  2.     <section>
  3.         <?php
  4.         if(!empty($data['portfolio_title'])) {
  5.         ?>
  6.             <div class="bgtitle"><h2><?php _e($data['portfolio_title'],'line'); ?></h2></div>
  7.         <?php } ?>
  8.        
  9.         <ul id="mycarousel">
  10.             <?php
  11.             if(!empty($data['portfolio_number'])) {
  12.                 $portfolio_nr = $data['portfolio_number'];
  13.             }
  14.             else {
  15.                 $portfolio_nr = -1;
  16.             }
  17.  
  18.             $args = array(
  19.                 'orderby'=> 'post_date',
  20.                 'order' => 'rand',
  21.                 'post_type' => 'portfolio',
  22.                 'posts_per_page' => $portfolio_nr
  23.             );
  24.            
  25.             $my_query = new WP_Query($args);
  26.             if( $my_query->have_posts() ) {
  27.                 while ($my_query->have_posts()) : $my_query->the_post();
  28.                
  29.                 $p_icon = get_post_meta($post->ID,'dt_portf_icon',true);   
  30.                 $thumb_ids = get_post_thumbnail_id($post->ID);
  31.  
  32.                 $pthumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-thumb');
  33.                 ?>
  34.                
  35.                 <li>
  36.  
  37.                     <?php
  38.                     $portf_icon = get_post_meta($post->ID,'dt_portf_icon',true);                       
  39.                     $thumb_id = get_post_thumbnail_id($post->ID);
  40.                    
  41.                     // Check if wordpress supports featured images, and if so output the thumbnail
  42.                     if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :
  43.                    
  44.                     ?>
  45.                         <a href="">
  46.                             <?php the_post_thumbnail('portfolio-thumb'); ?>
  47.                         </a>
  48.  
  49.                         <?php                              
  50.  
  51.                     endif; ?>  
  52.                        
  53.                     <?php // Output the title of each portfolio item ?>
  54.                     <span class="caption"><a href=""><?php echo get_the_title(); ?></a></span>                 
  55.                 </li>
  56.                 <?php endwhile; wp_reset_query(); } ?>
  57.         </ul>
  58.     </section>