Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php global $data; ?>
- <section>
- <?php
- if(!empty($data['portfolio_title'])) {
- ?>
- <div class="bgtitle"><h2><?php _e($data['portfolio_title'],'line'); ?></h2></div>
- <?php } ?>
- <ul id="mycarousel">
- <?php
- if(!empty($data['portfolio_number'])) {
- $portfolio_nr = $data['portfolio_number'];
- }
- else {
- $portfolio_nr = -1;
- }
- $args = array(
- 'orderby'=> 'post_date',
- 'order' => 'rand',
- 'post_type' => 'portfolio',
- 'portfolio_cats' => 'branding',
- 'posts_per_page' => $portfolio_nr
- );
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() ) {
- while ($my_query->have_posts()) : $my_query->the_post();
- $p_icon = get_post_meta($post->ID,'dt_portf_icon',true);
- $thumb_ids = get_post_thumbnail_id($post->ID);
- $pthumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-thumb');
- ?>
- <li>
- <?php
- $portf_icon = get_post_meta($post->ID,'dt_portf_icon',true);
- $thumb_id = get_post_thumbnail_id($post->ID);
- // Check if wordpress supports featured images, and if so output the thumbnail
- if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :
- if ($portf_icon == 'lightbox_to_image') { ?>
- <a href="<?php echo wp_get_attachment_url($thumb_id);?>" rel="prettyPhoto">
- <span class="item-on-hover">
- <span class="hover-image"></span>
- </span>
- <?php the_post_thumbnail('portfolio-thumb'); ?>
- </a>
- <?php }
- else if ($portf_icon == 'link_to_page') { ?>
- <a href="<?php the_permalink(); ?>">
- <span class="item-on-hover">
- <span class="hover-link"></span>
- </span>
- <?php the_post_thumbnail('portfolio-thumb'); ?>
- </a>
- <?php }
- else if ($portf_icon == 'lightbox_to_video') {
- $portfolio_slide = get_post_meta($post->ID,'dt_slider_repeat',true);
- if(!empty($portfolio_slide)) {
- $get_video = array();
- $j=0;
- foreach ($portfolio_slide as $slide){
- $video = $slide['dt_video_field_id'];
- if (!empty($video)) {
- $get_video[$j] = $video;
- $j++;
- }
- }
- }
- ?>
- <a href='<?php
- $input_string = $get_video[0];
- $count = preg_match('/src=(["\'])(.*?)\1/', $input_string, $match);
- if ($count === FALSE)
- echo('not found\n');
- else
- echo($match[2] . "\n");
- ?>'>
- <span class="item-on-hover">
- <span class="hover-video"></span>
- </span>
- <?php the_post_thumbnail('portfolio-thumb'); ?>
- </a>
- <?php }
- endif; ?>
- <?php // Output the title of each portfolio item ?>
- <span class="caption"><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></span>
- </li>
- <?php endwhile; wp_reset_query(); } ?>
- </ul>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement