Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 6.61 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /* Default Single Post */
  3. function gallery_post($pId){
  4.         global $use_post_id, $get_thumbnail;
  5.         $use_post_id = $pId;
  6.         $blog_post = new WP_Query("p=$pId");
  7.         $counter = 0;
  8.         if ($blog_post->have_posts()) : while ($blog_post->have_posts()) : $blog_post->the_post();
  9.                  $this_post = get_post($pId);  
  10.                 //Fetch the Custom Metas for this post
  11.                 $get_thumbnail = get_post_meta($pId, "other_media", true);
  12.                 $get_post_video = get_post_meta($pId, "main_video", true);
  13.                 if($get_thumbnail == "") :
  14.                         $post_image = fetch_post_image($pId, "600","2000");
  15.                 endif;
  16.                 $link = get_permalink($pId);
  17.  ?>    
  18.      <div class="clearfix">
  19.         <div id="left-column">
  20.             <div class="copy">
  21.                 <div class="post">
  22.                     <h2><a href="<?php echo $link; ?>"><?php the_title(); ?></a></h2>
  23.                     <h4 class="date">
  24.                                                 <?php the_time("dS F Y"); ?>,
  25.                             in <?php the_category(", "); ?>
  26.                         (<a id="comments-link" href="#comments"><?php echo $this_post->comment_count; ?> Comments</a>)
  27.                                         </h4>
  28.                     <div class="copy"><?php the_content(); ?></div>
  29.                 </div>                            
  30.                                 <?php ocmx_rating($pId); ?>
  31.             </div>
  32.         </div>
  33.         <div id="right-column">
  34.                         <?php if ($get_post_video !== "") :
  35.                 $get_post_video = preg_replace("/(width\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 600 $2", $get_post_video);
  36.                 $get_post_video = preg_replace("/(height\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 400 $2", $get_post_video);
  37.                 echo " <div class=\"post-gallery-image\" id=\"post-gallery-image\">$get_post_video</div>";
  38.             elseif ($get_thumbnail !== "") : ?>        
  39.                 <div class="post-gallery-image" id="post-gallery-image"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&amp;w=600&amp;h=&amp;zc=1" alt="<?php the_title(); ?>" /></div>
  40.             <?php elseif($post_image !== "") :
  41.                 echo " <div class=\"post-gallery-image\" id=\"post-gallery-image\">$post_image</div>";
  42.             endif; ?>
  43.             <?php $attachments = get_children(array("post_type" => "attachment", "post_parent" => $pId, "post_type" => "attachment", "post_mime_type" => "image"));
  44.                         $ttl_counter = 0;
  45.                         if(!(empty($attachments))) :?>
  46.                                 <div class="gallery-thumbnails clearfix">
  47.                                         <ul>
  48.                         <?php if ($get_thumbnail !== "") : ?>
  49.                                 <li><a href="#" id="<?php echo "image-href-0"; ?>"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&amp;w=80&amp;h=80&amp;zc=1" alt="<?php the_title(); ?>" /></a></li>
  50.                         <?php $counter = 2;
  51.                                                         $ttl_counter++;
  52.                                                 else :
  53.                                                         $counter = 1;
  54.                                                 endif ;?>
  55.                                                 <?php foreach($attachments as $attachement => $this_attachment) :
  56.                                                                 $attach_id = $this_attachment->ID;
  57.                                                                 $fetch_link = wp_get_attachment_image_src($attach_id);
  58.                                                 ?>
  59.                                                         <li <?php if($counter == 6) : ?>class="last"<?php endif; ?>>
  60.                                 <a href="#" id="<?php echo "image-href-".$ttl_counter; ?>">
  61.                                         <img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $fetch_link[0]; ?>&amp;w=80&amp;h=80&amp;zc=1" alt="" />
  62.                                     </a>
  63.                             </li>
  64.                                                 <?php
  65.                                                         if($counter == 6) :
  66.                                                                 $counter = 1;
  67.                                                         else :
  68.                                                                 $counter++;
  69.                                                         endif;
  70.                                                         $ttl_counter++;
  71.                                                 endforeach; ?>
  72.                                         </ul>
  73.                                 </div>
  74.                         <?php endif; ?>                
  75.                         <?php comments_template(); ?>
  76.         </div>
  77.     </div>
  78. <?php endwhile; else: ?>
  79.         <div id="left-column">
  80.         <div class="copy">
  81.                         <div class="post">
  82.                 <h2>No post found</h2>
  83.                 <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>
  84.                                 <div class="copy">
  85.                                         <p>Sorry, no posts matched your criteria.</p>
  86.                         </div>
  87.                         </div>
  88.                 </div>
  89.         </div>
  90. <?php endif;
  91. }
  92.  
  93. /* Blog Style Single Post */
  94. function regular_post($pId){
  95.         global $use_post_id;
  96.         $use_post_id = $pId;
  97.         $blog_post = new WP_Query("p=$pId"); ?>
  98. <div id="blog">
  99.           <?php if ($blog_post->have_posts()) : while ($blog_post->have_posts()) : $blog_post->the_post();            
  100.                         $this_post = get_post($pId);   
  101.                         //Fetch the Custom Metas for this post
  102.                         $get_thumbnail = get_post_meta($pId, "other_media", true);
  103.                         $get_post_video = get_post_meta($pId, "main_video", true);
  104.                         if($get_thumbnail == "") :
  105.                                 $post_image = fetch_post_image($pId, "600","2000");
  106.                         endif;
  107.                        
  108.             $link = get_permalink($pId);
  109.      ?>
  110.         <div id="left-column">
  111.                         <div class="copy">
  112.                 <div class="post">
  113.                                          <?php if ($get_post_video !== "") :
  114.                         $get_post_video = preg_replace("/(width\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 600 $2", $get_post_video);
  115.                         $get_post_video = preg_replace("/(height\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 400 $2", $get_post_video);
  116.                         echo "<div class=\"post-gallery-image\">$get_post_video</div>";
  117.                     elseif ($get_thumbnail !== "") : ?>        
  118.                         <div class="post-gallery-image"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&amp;w=600&amp;h=&amp;zc=1" alt="<?php the_title(); ?>" /></div>
  119.                     <?php else :
  120.                         echo "<div class=\"post-gallery-image\">$post_image</div>";
  121.                     endif; ?>
  122.                     <h2><a href="<?php echo $link; ?>"><?php the_title(); ?></a></h2>
  123.                     <h4 class="date">
  124.                                                 <?php the_time("dS F Y"); ?>,
  125.                             in <?php the_category(", "); ?>
  126.                         (<a id="comments-link" href="#comments"><?php echo $this_post->comment_count; ?> Comments</a>)
  127.                                         </h4>
  128.                     <div class="copy">
  129.                         <?php the_content(); ?>
  130.                     </div>
  131.                 </div>
  132.             </div>
  133.                 <?php comments_template(); ?>
  134.         </div>
  135.     <?php endwhile; else: ?>
  136.         <div id="left-column">
  137.             <div class="post">
  138.                 <h2>No post found</h2>
  139.                 <div class="copy">
  140.                     <p>Sorry, no posts matched your criteria.</p>
  141.                 </div>
  142.             </div>
  143.         </div>
  144.     <?php endif; ?>  
  145.     <?php get_sidebar(); ?>
  146. </div>
  147. <?php } ?>