Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php get_header(); ?>
- <?php
- if($single_sidebar_type == 'Sidebar2') { $sidebar_name = 'sidebar2'; }
- elseif($single_sidebar_type == 'Sidebar3') { $sidebar_name = 'sidebar3'; }
- elseif($single_sidebar_type == 'Sidebar4') { $sidebar_name = 'sidebar4'; }
- elseif($single_sidebar_type == 'Sidebar5') { $sidebar_name = 'sidebar5'; }
- else{ $sidebar_name = ''; }
- ?>
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <?php
- $type_name = get_post_type( $post->ID );
- if(get_post_type( $post->ID ) == 'post' && $single_layout_page_style == 'Left Sidebar') {
- echo '<br class="appear"><br class="appear">';
- get_sidebar($sidebar_name);
- wp_reset_query();
- }
- if($type_name == 'portfolio') {
- // get menu item id
- global $wpdb;
- $post_id = $wpdb->get_var( 'SELECT ID FROM '.$wpdb->posts.' WHERE post_name="'.$project_details_current_page.'" AND post_type="page" AND post_status="publish"' );
- $post_title = $wpdb->get_var( 'SELECT post_id FROM '.$wpdb->postmeta.' WHERE meta_key="_menu_item_object_id" AND meta_value="'.$post_id.'"' );
- ?>
- <script>
- jQuery(document).ready(function($) {
- $("#menu-item-<?php echo $post_title; ?>").addClass("current-menu-item");
- });
- </script>
- <?php
- $post_meta_data = get_post_custom($post->ID); // Get All of the Data at Once
- if(isset($post_meta_data['custom_repeatable'])) {$custom_repeatable = unserialize($post_meta_data['custom_repeatable'][0]);} //Job Description
- if(isset($post_meta_data['custom_project_format'])) {$project_format = $post_meta_data['custom_project_format'][0];} // Project Format
- if(isset($post_meta_data['custom_video'])) {$video_url = $post_meta_data['custom_video'][0]; } // Video URL
- if(isset($post_meta_data['custom_online_link'])) { $project_online_link = $post_meta_data['custom_online_link'][0]; } // Project Online Link
- if(isset($post_meta_data['custom_project_style'])) { $project_details_style = $post_meta_data['custom_project_style'][0];} // Project Details Style
- if(isset($post_meta_data['custom_use_online_link_images'])) { $use_online_link_images = $post_meta_data['custom_use_online_link_images'][0];} // Use Online Link On Project Details Images
- if(isset($post_meta_data['custom_top_project_widget'])) { $top_project_widget = $post_meta_data['custom_top_project_widget'][0];} // top widget for project details
- if(isset($post_meta_data['custom_down_project_widget'])) { $down_project_widget = $post_meta_data['custom_down_project_widget'][0];} // down widget for project details
- // get custom_repeatable for portfolio
- $post_meta_data2 = get_post_meta( $post->ID, 'images', true );
- // get post thumbnail
- if (has_post_thumbnail( $post->ID ) ):
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
- $feautured_image = $image[0];
- endif;
- // check for Project Format
- if($project_format == 'image') {
- $project_type = '
- <div class="flex-container">
- <div class="flexslider2">
- <ul class="slides">';
- if($post_meta_data2) {
- foreach ( (array) $post_meta_data2 as $meta) {
- if(empty($meta['image'])){ if(isset($feautured_image)) { $meta['image'] = $feautured_image ; } }
- if($use_online_link_images == 'no') {
- $link_caption_images = '
- <div class="caption">
- <a href="'.$meta['image'].'" rel="prettyPhoto[gallery1]"><img src="'.$meta['image'].'" >
- <span class="hover-effect big zoom"></span></a>
- </div><!-- hover effect -->
- ';
- } else {
- if(!empty($project_online_link)) {
- if(isset($project_online_link)) {$href_project_online_link = $project_online_link;}
- }
- $link_caption_images = '
- <div class="caption">
- <a href="'.$href_project_online_link.'" target="_blank"><img src="'.$meta['image'].'" >
- <span class="hover-effect big link"></span></a>
- </div><!-- hover effect -->
- ';
- }
- $project_type .= '<li>'.$link_caption_images.'</li>';
- }
- }
- $project_type .='
- </ul>
- </div>
- </div>
- ';
- }
- else {
- if(isset($video_url)) {$string = $video_url; } else { $string = ''; }
- if ( strpos($string, 'youtube') !== false )
- {
- $embed_code = str_replace('watch?v=', 'embed/', $video_url);
- // youtube video
- $video_file = '
- <div class="video-wrap widescreen">
- <iframe src="'.$embed_code.'?showinfo=1" frameborder="0" allowfullscreen frameborder="0" ></iframe>
- </div><!-- End youtube video wrap -->
- ';
- }
- elseif ( strpos($string, 'vimeo') !== false )
- {
- $embed_code = str_replace('vimeo.com/', 'player.vimeo.com/video/', $video_url);
- // vimeo video
- $video_file = '
- <div class="video-wrap widescreen vimeo">
- <iframe src="'.$embed_code.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
- </div><!-- End vimeo video wrap -->
- ';
- }
- else {
- if(isset($feautured_image)) { $feautured_image = $feautured_image;} else {$feautured_image = '';}
- if($use_online_link_images == 'no') {
- $link_caption_images = '
- <div class="caption">
- <a href="'.$feautured_image.'" rel="prettyPhoto[gallery1]"><img src="'.$feautured_image.'">
- <span class="hover-effect big zoom"></span></a>
- </div><!-- hover effect -->
- ';
- } else {
- if(!empty($project_online_link)) {
- if(isset($project_online_link)) {$href_project_online_link = $project_online_link;}
- }
- $link_caption_images = '
- <div class="caption">
- <a href="'.$href_project_online_link.'" target="_blank"><img src="'.$feautured_image.'">
- <span class="hover-effect big link"></span></a>
- </div><!-- hover effect -->
- ';
- }
- // image type
- $video_file = $link_caption_images;
- }
- $project_type = '
- <div class="image-post bottom-2">
- '.$video_file.'
- </div><!-- End video image-post -->
- ';
- }
- ?>
- <div class="sixteen columns">
- <h2 class="title big"><?php wp_title('', true, 'right'); ?>
- <!-- Next Porjects -->
- <?php
- $next_post = get_next_post();
- if (!empty( $next_post )): ?>
- <a href="<?php echo get_permalink( $next_post->ID ); ?>" data="<?php echo $next_post->post_title; ?>" class="next-project">
- </a>
- <?php endif;
- if (empty( $next_post )): ?>
- <a class="next-project disabled"></a>
- <?php endif; ?>
- <!-- Previous Porjects -->
- <?php
- $prev_post = get_previous_post();
- if (!empty( $prev_post )): ?>
- <a href="<?php echo get_permalink( $prev_post->ID ); ?>" data="<?php echo $prev_post->post_title; ?>" class="prev-project">
- </a>
- <?php endif;
- if (empty( $prev_post )): ?>
- <a class="prev-project disabled"></a>
- <?php endif; ?>
- <span class="line"></span></h2>
- </div><!-- Project Title -->
- <?php if($show_project_details_top_widget == 1 && !empty($project_details_top_widget)) { echo do_shortcode( stripslashes( $project_details_top_widget ) ); }?>
- <?php if($project_details_style == 'style1') { ?>
- <?php if( !empty($meta['image']) || !empty($feautured_image) || !empty($video_url) ){ ?>
- <!-- Start Project Slider -->
- <div class="twelve columns top bottom-2">
- <?php if(isset($top_project_widget)) { if(!empty($top_project_widget)) { echo do_shortcode($top_project_widget).'<br class="appear" />'; } } ?>
- <div class="slider-project">
- <?php echo $project_type; ?>
- </div><!-- End slider-project -->
- <?php if(isset($down_project_widget)) { if(!empty($down_project_widget)) { echo '<br class="appear" />'.do_shortcode($down_project_widget); } } ?>
- </div>
- <!-- End -->
- <?php } ?>
- <!-- Start Project Details -->
- <div class="four columns bottom">
- <h2 class="title small top-5 bottom-2"><?php _e("Listen & Download", "jozoorthemes"); ?> <span class="line"></span></h2>
- <div class="about-project bottom">
- <?php the_content(); ?>
- </div>
- <div class="clearfix"></div>
- <?php if(!empty($custom_repeatable) && !empty($custom_repeatable[0])) { ?>
- <h2 class="title small bottom-2"><?php _e("Track Details", "jozoorthemes"); ?> <span class="line"></span></h2>
- <ul class="square-list job bottom-2">
- <?php foreach ($custom_repeatable as $stringrepeatable) { echo '<li><a>'.$stringrepeatable.'</a></li>'; } ?>
- </ul><!-- End square-list -->
- <?php } ?>
- <?php if(!empty($project_online_link)) { ?>
- <a href="<?php if(isset($project_online_link)) {echo $project_online_link;} ?>" target="_blank" class="button medium color"><?php _e("Download", "jozoorthemes"); ?></a>
- <?php } ?>
- </div>
- <!-- End Project Details -->
- <?php }
- elseif ($project_details_style == 'style2') {?>
- <?php if( !empty($meta['image']) || !empty($feautured_image) || !empty($video_url) ){ ?>
- <!-- Start Project Slider -->
- <div class="sixteen columns top bottom-2">
- <?php if(isset($top_project_widget)) { if(!empty($top_project_widget)) { echo do_shortcode($top_project_widget).'<br class="appear" />'; } } ?>
- <div class="slider-project">
- <?php echo $project_type; ?>
- </div><!-- End slider-project -->
- <?php if(isset($down_project_widget)) { if(!empty($down_project_widget)) { echo '<br class="appear" />'.do_shortcode($down_project_widget); } } ?>
- </div>
- <!-- End -->
- <?php } ?>
- <div class="clearfix"></div>
- <!-- Start Project Details -->
- <div class="<?php if(empty($custom_repeatable[0]) && empty($project_online_link)) { ?> sixteen columns <?php } else { ?>twelve columns <?php } ?> bottom">
- <h2 class="title small"><?php _e("Listen & Download", "jozoorthemes"); ?> <span class="line"></span></h2>
- <div class="about-project bottom">
- <?php the_content(); ?>
- </div>
- </div>
- <!-- End Project Details -->
- <div class="four columns bottom">
- <?php if(!empty($custom_repeatable) && !empty($custom_repeatable[0])) { ?>
- <h2 class="title small"><?php _e("Track Details", "jozoorthemes"); ?> <span class="line"></span></h2>
- <ul class="square-list job bottom-2">
- <?php foreach ($custom_repeatable as $stringrepeatable) { echo '<li><a>'.$stringrepeatable.'</a></li>'; } ?>
- </ul><!-- End square-list -->
- <?php } ?>
- <?php if(!empty($project_online_link)) { ?>
- <a href="<?php if(isset($project_online_link)) {echo $project_online_link;} ?>" class="button medium color"><?php _e("Download", "jozoorthemes"); ?></a>
- <?php } ?>
- </div>
- <!-- End -->
- <?php } ?>
- <?php if($show_project_details_down_widget == 1 && !empty($project_details_down_widget)) { echo do_shortcode( stripslashes( $project_details_down_widget ) ); }?>
- <div class="clearfix"></div>
- <!-- Start Related Projects -->
- <?php if($project_details_style1 == 1) { ?>
- <?php
- //Get array of terms
- $terms = get_the_terms( $post->ID , 'project-type', 'string');
- //Pluck out the IDs to get an array of IDS
- if($terms) {
- $term_ids = array_values( wp_list_pluck($terms,'term_id') );
- //Query posts with tax_query. Choose in 'IN' if want to query posts with any of the terms
- //Chose 'AND' if you want to query for posts with all terms
- $second_query = new WP_Query( array(
- 'post_type' => 'portfolio',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'project-type',
- 'field' => 'id',
- 'terms' => $term_ids,
- 'operator'=> 'IN' //Or 'AND' or 'NOT IN'
- )),
- 'posts_per_page' => 4,
- 'ignore_sticky_posts' => 1,
- 'orderby' => 'rand',
- 'post__not_in'=>array($post->ID)
- ) );
- if($second_query->have_posts()) {
- ?>
- <div class="recent-work clearfix">
- <div class="slidewrap" >
- <div class="sixteen columns"> <h2 class="title small"><?php _e("Related Projects", "jozoorthemes"); ?> <span class="line"></span></h2> </div>
- <ul class="slider" id="sliderName">
- <li class="slide">
- <?php
- while ($second_query->have_posts() ) : $second_query->the_post();
- $post_meta_data = get_post_custom($post->ID); // Get All of the Data at Once
- if(isset($post_meta_data['custom_slideshow_link'])) {$slideshow_link = $post_meta_data['custom_slideshow_link'][0];} // Slideshow Link
- if(isset($post_meta_data['custom_project_format'])) {$project_format = $post_meta_data['custom_project_format'][0];} // Project Format
- if(isset($post_meta_data['custom_video'])) {$video_url = $post_meta_data['custom_video'][0];} // Video URL
- // get post thumbnail
- if (has_post_thumbnail( $post->ID ) ):
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
- $feautured_image = $image[0];
- endif;
- // check for Slideshow Link
- if($slideshow_link == 'yes') {
- // check for Project Format
- if($project_format == 'image') {
- $hover_class = 'zoom';
- $project_link = '<a href="'.$feautured_image.'" rel="prettyPhoto[]">' ;
- }
- else {
- if(empty($video_url)){ $video_url = $feautured_image ;}
- $hover_class = 'video';
- $project_link = '<a href="'.$video_url.'" rel="prettyPhoto[]">' ;
- }
- }
- else {
- $hover_class = 'link';
- $direct_link = get_permalink();
- $project_link = '<a href="'.$direct_link.'">' ;
- }
- ?>
- <div class="four columns item">
- <div class="caption">
- <?php echo $project_link; ?>
- <img src="<?php if(isset($feautured_image)) { echo $feautured_image; } ?>" alt="" class="pic column-4" />
- <span class="hover-effect <?php echo $hover_class; ?>"></span></a>
- </div><!-- hover effect -->
- <h4><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h4>
- <p>
- <?php
- $terms = get_the_terms( $post->ID, 'project-type' );
- if ( $terms && ! is_wp_error( $terms ) ) :
- $draught_links = array();
- foreach ( $terms as $term ) {
- $draught_links[] = $term->name;
- }
- echo $on_draught = join( ", ", $draught_links );
- endif;
- ?>
- </p>
- </div>
- <?php endwhile;
- wp_reset_query();
- ?>
- </li><!-- End slide -->
- </ul>
- </div><!-- End slidewrap -->
- </div><!-- End Related Projects -->
- <?php
- }
- else { echo '<br class="appear">';}
- }
- }
- ?>
- <?php
- }
- elseif($type_name == 'post') {
- // set post views
- setPostViews(get_the_ID());
- // get menu item id
- global $wpdb;
- $post_id = $wpdb->get_var( 'SELECT ID FROM '.$wpdb->posts.' WHERE post_name="'.$single_post_current_page.'" AND post_type="page" AND post_status="publish"' );
- $post_title = $wpdb->get_var( 'SELECT post_id FROM '.$wpdb->postmeta.' WHERE meta_key="_menu_item_object_id" AND meta_value="'.$post_id.'"' );
- ?>
- <script>
- jQuery(document).ready(function($) {
- $("#menu-item-<?php echo $post_title; ?>").addClass("current-menu-item");
- });
- </script>
- <!-- Start Single Post -->
- <?php if($single_layout_page_style == 'Full Width') { echo '<div class="sixteen columns top bottom">'; } else { ?>
- <div class="eleven columns top bottom">
- <?php } ?>
- <!-- ==================== Single Post ==================== -->
- <div class="post gallery bottom">
- <?php if($single_layout_page_style == 'Left Sidebar') { echo ''; } else { ?>
- <br class="appear"><br class="appear"><br class="appear">
- <?php } ?>
- <h2 class="title big top-2 bottom-2"><?php the_title(); ?> <span class="line"></span></h2>
- <!-- Title Post -->
- <div class="post-meta bottom-2 transparent">
- <div class="meta"><span class="history icon gray"></span> <?php _e("On", "jozoorthemes"); ?> <?php the_time('d M, Y'); ?> </div><!-- Date -->
- <div class="meta"><span class="more-items icon gray"></span>
- <?php
- $categories = get_the_category();
- $separator = ', ';
- $output = '';
- if($categories){
- foreach($categories as $category) {
- $output .= '<a href="'.get_category_link($category->term_id ).'" data="' . esc_attr( sprintf( __( "View all posts in %s", "jozoorthemes" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator;
- }
- echo trim($output, $separator);
- }
- ?>
- </div><!-- Category -->
- <div class="meta"><span class="user icon gray"></span> <?php _e("By : ", "jozoorthemes"); ?> <?php the_author(); ?> </div><!-- Author -->
- <div class="meta"><span class="conversation icon gray"></span> <?php comments_number( __("No Comments", "jozoorthemes") , __("With 1 Comment", "jozoorthemes"), __("With % Comments", "jozoorthemes") ); ?> </div><!-- Comments -->
- <div class="meta"><span class="eye_open icon gray"></span> <?php _e("Views :", "jozoorthemes"); ?> <?php echo getPostViews(get_the_ID()); ?> </div><!-- Views -->
- </div><!-- End post-meta -->
- <!-- Start top post content widget -->
- <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Top Post')) { } else { } ?>
- <!-- End widget -->
- <?php
- $post_meta_data = get_post_custom($post->ID); // Get All of the Data at Once
- if(isset($post_meta_data['customposts_post_format'])) {$post_format = $post_meta_data['customposts_post_format'][0];} else { $post_format = 'image';} // Project Format
- if(isset($post_meta_data['customposts_post_video'])) {$video_url = $post_meta_data['customposts_post_video'][0];} else { $video_url = '';} // Video URL
- if(isset($post_meta_data['customposts_post_soundcloud'])) {$soundcloud_code = $post_meta_data['customposts_post_soundcloud'][0];} else { $soundcloud_code = '';} // SoundCloud Url
- // get custom_repeatable for portfolio
- $post_meta_data2 = get_post_meta( $post->ID, 'images', true );
- // get post thumbnail
- if (has_post_thumbnail( $post->ID ) ):
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
- $feautured_image = $image[0];
- endif;
- $permalink_post = get_permalink(); //permalink
- //$post_title_alt = the_title(); // post title
- // check for Post Format
- if($post_format == 'slider') {
- if(empty($post_meta_data2) && empty($feautured_image) ){
- $postformat = '';
- }
- else {
- $postformat = '
- <div class="image-post bottom">
- <div class="flex-container">
- <div class="flexslider3">
- <ul class="slides">';
- foreach ( (array) $post_meta_data2 as $meta) {
- if(empty($meta['image'])){ $meta['image'] = $feautured_image ;}
- $postformat .= '<li><img src="'.$meta['image'].'" ></li>';
- }
- $postformat .= '
- </ul>
- </div>
- </div>
- </div><!-- End slider image-post -->
- ';
- }
- }
- elseif($post_format == 'video') {
- if(empty($video_url) && empty($feautured_image) ){
- $postformat = '';
- }
- else {
- if(isset($video_url)) {$string = $video_url; } else { $string = ''; }
- if ( strpos($string, 'youtube') !== false )
- {
- // youtube video
- $video_file = '
- <div class="video-wrap widescreen">
- <iframe src="'.$video_url.'?showinfo=1" frameborder="0" allowfullscreen frameborder="0" ></iframe>
- </div><!-- End youtube video wrap -->
- ';
- }
- elseif ( strpos($string, 'vimeo') !== false )
- {
- // vimeo video
- $video_file = '
- <div class="video-wrap widescreen vimeo">
- <iframe src="'.$video_url.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
- </div><!-- End vimeo video wrap -->
- ';
- }
- else {
- if(isset($feautured_image)) { $feautured_image = $feautured_image; } else { $feautured_image = '';}
- // image type
- $video_file = '
- <img src="'.$feautured_image.'">
- ';
- }
- $postformat = '
- <div class="image-post bottom">
- '.$video_file.'
- </div><!-- End video image-post -->
- ';
- }
- }
- elseif($post_format == 'soundcloud') {
- if(empty($soundcloud_code) && empty($feautured_image) ){
- $postformat = '';
- }
- else {
- if(!empty($soundcloud_code)) {
- $soundcloud_final = $soundcloud_code;
- }
- else {
- if(isset($feautured_image)) { $feautured_image = $feautured_image; } else { $feautured_image = '';}
- // image type
- $soundcloud_final = '
- <a href="'.$permalink_post.'"><img src="'.$feautured_image.'"></a>
- ';
- }
- $postformat = '
- <div class="image-post bottom-2">
- '.$soundcloud_final.'
- </div><!-- End video image-post -->
- ';
- }
- }
- elseif($post_format == 'image') {
- if(empty($feautured_image) ){
- $postformat = '';
- }
- else {
- $postformat = '
- <div class="image-post bottom">
- <img src="'.$feautured_image.'">
- </div><!-- End single image image-post -->
- ';
- }
- }
- ?>
- <?php echo $postformat; ?>
- <div class="post-content bottom">
- <?php the_content(); ?>
- <br class="appear">
- <?php edit_post_link('[ <span class="color">'.__("Edit This Post", "jozoorthemes").'</span> ]','',''); ?>
- </div><!-- End post-content -->
- <!-- Start down post content widget -->
- <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Down Post')) { } else { } ?>
- <!-- End widget -->
- <hr class="bottom-2"/>
- <?php if( has_tag() ) { ?>
- <?php if($show_tags == 1) { ?>
- <div class="popular-tags small top bottom-2">
- <span class="tags icon gray"></span> <?php _e("Tags :", "jozoorthemes"); ?>
- <?php the_tags('', '', ''); ?>
- </div><!-- End tags -->
- <hr class="bottom-2"/>
- <?php } } ?>
- <?php if($show_prevnext_post == 1) { ?>
- <div class="top bottom">
- <!-- Previous Porjects -->
- <?php
- $prev_post = get_previous_post();
- if (!empty( $prev_post )): ?>
- <a href="<?php echo get_permalink( $prev_post->ID ); ?>" data="<?php echo $prev_post->post_title; ?>" class="prev-post">
- <span class="left_arrow icon gray"></span> <?php _e("Previous Post", "jozoorthemes"); ?></a>
- <?php endif; ?>
- <!-- Next Porjects -->
- <?php
- $next_post = get_next_post();
- if (!empty( $next_post )): ?>
- <a href="<?php echo get_permalink( $next_post->ID ); ?>" data="<?php echo $next_post->post_title; ?>" class="next-post">
- <?php _e("Next Post", "jozoorthemes"); ?> <span class="right_arrow icon gray"></span></a>
- <?php endif; ?>
- </div><!-- End next-prev post -->
- <?php } ?>
- <?php if($show_author_box == 1) { global $id_or_email; ?>
- <br class="appear">
- <h4 class="title"><?php _e("About The Author", "jozoorthemes"); ?><span class="line"></span></h4>
- <div class="info-box">
- <!-- <img src="images/img/team/author.jpg" alt="" class="pic-2" /> -->
- <?php echo get_avatar( get_the_author_meta('ID'), $size = '80', $default = '' ); ?>
- <h5><span class="color"><?php the_author_link(); ?></span> </h5>
- <p><?php the_author_meta('description'); ?> </p>
- <hr class="top-3 bottom-2" />
- <?php _e("Number of Posts :", "jozoorthemes"); ?> <span class="color"><?php echo get_the_author_posts(); ?></span>
- <div class="right">
- <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php _e("All Posts by :", "jozoorthemes"); ?> <?php the_author_meta('display_name'); ?></a>
- </div>
- </div>
- <?php } ?>
- <?php if($show_related_posts == 1) { ?>
- <!-- Start Related Projects -->
- <?php
- $orig_post = $post;
- $tags = wp_get_post_tags($post->ID);
- if ($tags) {
- $tag_ids = array();
- foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
- $args=array(
- 'tag__in' => $tag_ids,
- 'post__not_in' => array($post->ID),
- 'post_type' => 'post',
- 'posts_per_page'=>4, // Number of related posts to display.
- 'orderby' => 'rand',
- 'ignore_sticky_posts'=>1
- );
- $my_query = new wp_query( $args );
- if( $my_query->have_posts() ) {
- ?>
- <h4 class="title"><?php _e("Related Posts", "jozoorthemes"); ?><span class="line"></span></h4>
- <ul class="most-posts">
- <?php
- while( $my_query->have_posts() ) {
- $my_query->the_post();
- // get post thumbnail
- if (has_post_thumbnail( $post->ID ) ):
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
- $feautured_image = $image[0];
- endif;
- ?>
- <li class="one-third column alpha omega">
- <?php if (has_post_thumbnail( $post->ID ) ) {?>
- <a href="<?php echo get_permalink(); ?>"><img src="<?php if(isset($feautured_image)) { echo $feautured_image; } ?>" alt="" class="pic-2" /></a>
- <?php } else { echo ''; } ?>
- <p><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></p>
- </li>
- <?php }
- ?>
- </ul><!-- End square-list -->
- <?php
- }
- }
- $post = $orig_post;
- wp_reset_query();
- ?>
- <!-- End Related Projects -->
- <?php } ?>
- <div class="clearfix"></div>
- <?php comments_template(); ?>
- </div>
- <!-- ==================== End single post ==================== -->
- </div><!-- End column -->
- <?php
- }
- ?>
- <?php endwhile; endif; ?>
- <?php
- if(get_post_type( $post->ID ) == 'post' && $single_layout_page_style == 'Right Sidebar') {
- echo '<br class="appear"><br class="appear"><br class="appear">';
- get_sidebar($sidebar_name);
- }
- if(get_post_type( $post->ID ) == 'post' && $single_layout_page_style == 'Full Width') {
- echo '';
- }
- ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement