ellp

Untitled

Sep 18th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.63 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. use image-post in custom fields to add preview images in main page
  5.  
  6. categories used in test website.
  7. $headline_cat = 77;
  8. $front_cat_list = "77,558,112,192,80,93,73,";
  9. */
  10.  
  11.  
  12. /* categories used in final website*/
  13. $headline_cat = 13;
  14. /* old categories (18set2012)
  15. $front_cat_list = "13,460,55,12,18,3,323,43"; */
  16. $front_cat_list = "10,458,12,460,55,18,102,43";
  17.  
  18. get_header() ?>
  19.  
  20.     <div id="wrapper">
  21.         <div id="content">
  22.  
  23.             <div id="headline">
  24.                 <div id="headline-content" class="glidecontentwrapper">
  25.                     <?php $headline = new WP_Query('cat='.$headline_cat.'&showposts=3'); while($headline->have_posts()) : $headline->the_post(); ?>
  26.                     <div class="clearfix glidecontent">
  27.  
  28.                         <?php
  29.                         $headline_preview = get_post_custom_values("post-image");
  30.                         if ( is_array($headline_preview) ) { ?>
  31.                             <img class="teaser-image" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, 'post-image',true) ?>&w=390&h=252&zc=1&q=100" alt="<?php the_title(); ?>" title="<?php the_title() ?>" width="390" height="252"/>
  32.                         <?php } else { ?>
  33.                             <img class="teaser-image" src="<?php bloginfo('template_directory'); ?>/images-replace-headline/headline-<?php echo(rand(1,10)); ?>-390x252.jpg" alt="<?php the_title(); ?>" title="<?php the_title() ?>" width="390" height="252" />
  34.                         <?php } ?>
  35.  
  36.                         <div class="teaser-main">
  37.                             <div class="teaser-wrap">
  38.                                 <div class="overlay"></div>
  39.                                 <h3 class="teaser-title"><a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>"><?php the_title(); ?></a></h3>
  40.                                 <div class="teaser-text">Read More...</div>
  41.                             </div>
  42.                         </div>
  43.  
  44.                     </div>
  45.                     <?php endwhile; ?>
  46.                 </div><!-- .glidecontentwrapper -->
  47.  
  48.                 <div id="teaser" class="glidecontenttoggler">
  49.                     <?php $teaser_small = new WP_Query('cat='.$headline_cat.'&showposts=3'); while($teaser_small->have_posts()) : $teaser_small->the_post(); ?>
  50.                     <a href="#" class="toc">
  51.                     <span class="togglerwrap">
  52.                         <span class="togglercontent clearfix">
  53.                             <?php
  54.                             $teaser_preview = get_post_custom_values("post-image");
  55.                             if ( is_array($teaser_preview) ) { ?>
  56.                                 <img class="teaser-image-small" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, 'post-image',true) ?>&w=75&h=65&zc=1&q=100" alt="<?php the_title(); ?>" title="<?php the_title() ?>" />
  57.                             <?php } else { ?>
  58.                                 <img class="teaser-image-small" src="<?php bloginfo('template_directory'); ?>/images-replace-small/small-<?php echo(rand(1,10)); ?>-75x65.jpg" alt="<?php the_title(); ?>" title="<?php the_title() ?>" width="75" height="65"/>
  59.                             <?php } ?>
  60.  
  61.                             <h3 class="togglertitle"><?php the_title(); ?></h3>
  62.                         </span>
  63.                     </span>
  64.                     </a>
  65.                     <?php endwhile; ?>
  66.                 </div><!-- .glidecontenttoggler -->
  67.             </div><!-- #headline -->
  68.  
  69.  
  70.             <div id="list-categories">
  71.                 <p class="section-title"><?php _e( 'Latest News', 'wpbx' ) ?></p>
  72. <?php
  73.     // Flag to indicate alternating columns
  74.     $catLeftCol = true;
  75.     $intCount = 0;
  76.  
  77.     // Determine how many posts to show per category
  78.     $intPostCount = 5; 
  79.  
  80.     // Retrieve a list of selected categories
  81.     // Category Ajust $categories = get_categories("orderby=ID&order=asc&hide_empty=1&hierarchial=0&include=$front_cat_list");
  82.     $categories = get_categories("hierarchial=0&include=$front_cat_list");
  83.    
  84.  
  85.     // Iterate over each category
  86.     foreach ($categories as $category)
  87.     {
  88.         // Retrieve a handful of posts for this category
  89.         query_posts("cat=" . $category->cat_ID . "&showposts=$intPostCount&orderby=date&order=DESC");
  90.        
  91.         // Increment the debug counter
  92.         $intCount++;
  93.            
  94. ?>
  95.         <!-- Loop: <?php echo $intCount; ?> -->
  96. <?php          
  97.         // Initialise the thumb display flag
  98.         $catFirstPost = true;
  99.  
  100.         // Do we have any categories to display?
  101.         while (have_posts())
  102.         {
  103.  
  104.             // Advance the post queue
  105.             the_post(); $do_not_duplicate = $post->ID;
  106.  
  107.             // Is this the first post in the category?
  108.             if ($catFirstPost)
  109.             {
  110. ?>
  111. <?php
  112.             // Check whether we need to create the "row wrapper"
  113.             if ($catLeftCol)
  114.             {
  115. ?>
  116.                 <div class="entry-row clearfix">
  117. <?php
  118.             }
  119. ?>
  120.  
  121.                     <div id="<?php echo $category->slug; ?>-list" class="entry-list">
  122.                         <h2 class="entry-list-cat-title">
  123.                             <a href="<?php echo get_category_link($category->cat_ID); ?>" title="More articles in <?php echo $category->name; ?>"><?php echo $category->name; ?> &raquo;</a>
  124.                         </h2>
  125.  
  126.                         <h3 class="entry-list-title"><a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>"><?php the_title(); ?></a></h3>
  127.                         <div class="entry-list-meta">
  128.                             <span class="entry-list-date"><?php unset($previousday); printf( __( '%1$s', 'wpbx' ), the_date( 'D, M j Y', '', '', false ) ) ?></span>
  129.                             <span class="entry-meta-sep">|</span>
  130.                             <span class="entry-list-comm"><?php comments_popup_link( __( 'No Comments', 'wpbx' ), __( '1 Comment', 'wpbx' ), __( '% Comments', 'wpbx' ) ) ?></span>
  131.                         </div>
  132.  
  133.                         <div class="entry-list-thumb">
  134.                             <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
  135.                             <?php
  136.                             $entry_preview = get_post_custom_values("post-image");
  137.                             if ( is_array($entry_preview) ) { ?>
  138.                                 <img class="entry-preview" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, 'post-image',true) ?>&w=260&h=110&zc=1" alt="<?php the_title(); ?>" title="<?php the_title() ?>" width="260" height="110"/>
  139.                             <?php } else { ?>
  140.                                 <img class="entry-preview" src="<?php bloginfo('template_directory'); ?>/images-replace-big/big-<?php echo(rand(1,10)); ?>-260x110.jpg" alt="<?php the_title(); ?>" width="260" height="110" title="<?php the_title() ?>" width="260" height="110"/>
  141.                             <?php } ?>
  142.                             </a>
  143.                         </div>
  144.  
  145.                         <div class="entry-list-content">
  146.                             <?php the_content_limit(150, ''); ?>
  147.                         </div>
  148.  
  149.                         <p class="more-link">More in <?php echo $category->name; ?></p>
  150.                         <ul>
  151. <?php      
  152.                 // First post display is complete
  153.                 $catFirstPost = false;
  154.                 the_post() == $do_not_duplicate;
  155.  
  156.             } // if ($catFirstPost)
  157. ?>
  158.  
  159.                             <li class="clearfix">
  160.                                 <span class="entry-star"><img src="<?php bloginfo('template_directory'); ?>/images/bullet-star.png" alt="#" /></span>
  161.                                 <h3><a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>"><?php the_title(); ?></a></h3>
  162.                                 <div class="entry-meta">
  163.                                     <span class="entry-date"><?php unset($previousday); printf( __( '%1$s', 'wpbx' ), the_date( 'D, M j Y', '', '', false ) ) ?></span>
  164.                                     <span class="entry-meta-sep">|</span>
  165.                                     <span class="entry-comm"><?php comments_popup_link( __( 'No Comments', 'wpbx' ), __( '1 Comment', 'wpbx' ), __( '% Comments', 'wpbx' ) ) ?></span>
  166.                                 </div>
  167.                             </li>
  168.  
  169. <?php
  170.         } // while (have_posts())
  171. ?>
  172.                         </ul>
  173.                     </div>
  174.  
  175. <?php          
  176.         /*
  177.             If we've run out of posts to display, we need to close the "row"
  178.         */
  179.         if (!$catLeftCol)
  180.         {
  181. ?>
  182.                 </div><!-- .entry-row -->
  183.  
  184. <?php          
  185.         }
  186.            
  187.         // Toggle the alternator
  188.         $catLeftCol = !$catLeftCol;
  189.  
  190.     } // end foreach category
  191.  
  192.     // Account for odd number of posts
  193.     if (!$catLeftCol)
  194.     {
  195. ?>
  196.                 </div><!-- .entry-row -->
  197.  
  198. <?php          
  199.     }
  200. ?>     
  201.  
  202.             </div><!-- #list-categories -->
  203.  
  204.         </div><!-- #content -->
  205.     </div><!-- #wrapper -->
  206.  
  207. <?php get_sidebar() ?>
  208. <?php get_footer() ?>
Advertisement
Add Comment
Please, Sign In to add comment