- <?php
- /* Default Single Post */
- function gallery_post($pId){
- global $use_post_id, $get_thumbnail;
- $use_post_id = $pId;
- $blog_post = new WP_Query("p=$pId");
- $counter = 0;
- if ($blog_post->have_posts()) : while ($blog_post->have_posts()) : $blog_post->the_post();
- $this_post = get_post($pId);
- //Fetch the Custom Metas for this post
- $get_thumbnail = get_post_meta($pId, "other_media", true);
- $get_post_video = get_post_meta($pId, "main_video", true);
- if($get_thumbnail == "") :
- $post_image = fetch_post_image($pId, "600","2000");
- endif;
- $link = get_permalink($pId);
- ?>
- <div class="clearfix">
- <div id="left-column">
- <div class="copy">
- <div class="post">
- <h2><a href="<?php echo $link; ?>"><?php the_title(); ?></a></h2>
- <h4 class="date">
- <?php the_time("dS F Y"); ?>,
- in <?php the_category(", "); ?>
- (<a id="comments-link" href="#comments"><?php echo $this_post->comment_count; ?> Comments</a>)
- </h4>
- <div class="copy"><?php the_content(); ?></div>
- </div>
- <?php ocmx_rating($pId); ?>
- </div>
- </div>
- <div id="right-column">
- <?php if ($get_post_video !== "") :
- $get_post_video = preg_replace("/(width\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 600 $2", $get_post_video);
- $get_post_video = preg_replace("/(height\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 400 $2", $get_post_video);
- echo " <div class=\"post-gallery-image\" id=\"post-gallery-image\">$get_post_video</div>";
- elseif ($get_thumbnail !== "") : ?>
- <div class="post-gallery-image" id="post-gallery-image"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&w=600&h=&zc=1" alt="<?php the_title(); ?>" /></div>
- <?php elseif($post_image !== "") :
- echo " <div class=\"post-gallery-image\" id=\"post-gallery-image\">$post_image</div>";
- endif; ?>
- <?php $attachments = get_children(array("post_type" => "attachment", "post_parent" => $pId, "post_type" => "attachment", "post_mime_type" => "image"));
- $ttl_counter = 0;
- if(!(empty($attachments))) :?>
- <div class="gallery-thumbnails clearfix">
- <ul>
- <?php if ($get_thumbnail !== "") : ?>
- <li><a href="#" id="<?php echo "image-href-0"; ?>"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&w=80&h=80&zc=1" alt="<?php the_title(); ?>" /></a></li>
- <?php $counter = 2;
- $ttl_counter++;
- else :
- $counter = 1;
- endif ;?>
- <?php foreach($attachments as $attachement => $this_attachment) :
- $attach_id = $this_attachment->ID;
- $fetch_link = wp_get_attachment_image_src($attach_id);
- ?>
- <li <?php if($counter == 6) : ?>class="last"<?php endif; ?>>
- <a href="#" id="<?php echo "image-href-".$ttl_counter; ?>">
- <img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $fetch_link[0]; ?>&w=80&h=80&zc=1" alt="" />
- </a>
- </li>
- <?php
- if($counter == 6) :
- $counter = 1;
- else :
- $counter++;
- endif;
- $ttl_counter++;
- endforeach; ?>
- </ul>
- </div>
- <?php endif; ?>
- <?php comments_template(); ?>
- </div>
- </div>
- <?php endwhile; else: ?>
- <div id="left-column">
- <div class="copy">
- <div class="post">
- <h2>No post found</h2>
- <h4 class="date"><?php the_time("d M Y"); ?>, Posted by <?php the_author(); ?> in <?php the_category(","); ?>, (<a id="comments-link" href="#comments"><?php echo $this_post->comment_count; ?> Comments</a>)</h4>
- <div class="copy">
- <p>Sorry, no posts matched your criteria.</p>
- </div>
- </div>
- </div>
- </div>
- <?php endif;
- }
- /* Blog Style Single Post */
- function regular_post($pId){
- global $use_post_id;
- $use_post_id = $pId;
- $blog_post = new WP_Query("p=$pId"); ?>
- <div id="blog">
- <?php if ($blog_post->have_posts()) : while ($blog_post->have_posts()) : $blog_post->the_post();
- $this_post = get_post($pId);
- //Fetch the Custom Metas for this post
- $get_thumbnail = get_post_meta($pId, "other_media", true);
- $get_post_video = get_post_meta($pId, "main_video", true);
- if($get_thumbnail == "") :
- $post_image = fetch_post_image($pId, "600","2000");
- endif;
- $link = get_permalink($pId);
- ?>
- <div id="left-column">
- <div class="copy">
- <div class="post">
- <?php if ($get_post_video !== "") :
- $get_post_video = preg_replace("/(width\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 600 $2", $get_post_video);
- $get_post_video = preg_replace("/(height\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 400 $2", $get_post_video);
- echo "<div class=\"post-gallery-image\">$get_post_video</div>";
- elseif ($get_thumbnail !== "") : ?>
- <div class="post-gallery-image"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&w=600&h=&zc=1" alt="<?php the_title(); ?>" /></div>
- <?php else :
- echo "<div class=\"post-gallery-image\">$post_image</div>";
- endif; ?>
- <h2><a href="<?php echo $link; ?>"><?php the_title(); ?></a></h2>
- <h4 class="date">
- <?php the_time("dS F Y"); ?>,
- in <?php the_category(", "); ?>
- (<a id="comments-link" href="#comments"><?php echo $this_post->comment_count; ?> Comments</a>)
- </h4>
- <div class="copy">
- <?php the_content(); ?>
- </div>
- </div>
- </div>
- <?php comments_template(); ?>
- </div>
- <?php endwhile; else: ?>
- <div id="left-column">
- <div class="post">
- <h2>No post found</h2>
- <div class="copy">
- <p>Sorry, no posts matched your criteria.</p>
- </div>
- </div>
- </div>
- <?php endif; ?>
- <?php get_sidebar(); ?>
- </div>
- <?php } ?>