Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- use image-post in custom fields to add preview images in main page
- categories used in test website.
- $headline_cat = 77;
- $front_cat_list = "77,558,112,192,80,93,73,";
- */
- /* categories used in final website*/
- $headline_cat = 13;
- /* old categories (18set2012)
- $front_cat_list = "13,460,55,12,18,3,323,43"; */
- $front_cat_list = "10,458,12,460,55,18,102,43";
- get_header() ?>
- <div id="wrapper">
- <div id="content">
- <div id="headline">
- <div id="headline-content" class="glidecontentwrapper">
- <?php $headline = new WP_Query('cat='.$headline_cat.'&showposts=3'); while($headline->have_posts()) : $headline->the_post(); ?>
- <div class="clearfix glidecontent">
- <?php
- $headline_preview = get_post_custom_values("post-image");
- if ( is_array($headline_preview) ) { ?>
- <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"/>
- <?php } else { ?>
- <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" />
- <?php } ?>
- <div class="teaser-main">
- <div class="teaser-wrap">
- <div class="overlay"></div>
- <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>
- <div class="teaser-text">Read More...</div>
- </div>
- </div>
- </div>
- <?php endwhile; ?>
- </div><!-- .glidecontentwrapper -->
- <div id="teaser" class="glidecontenttoggler">
- <?php $teaser_small = new WP_Query('cat='.$headline_cat.'&showposts=3'); while($teaser_small->have_posts()) : $teaser_small->the_post(); ?>
- <a href="#" class="toc">
- <span class="togglerwrap">
- <span class="togglercontent clearfix">
- <?php
- $teaser_preview = get_post_custom_values("post-image");
- if ( is_array($teaser_preview) ) { ?>
- <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() ?>" />
- <?php } else { ?>
- <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"/>
- <?php } ?>
- <h3 class="togglertitle"><?php the_title(); ?></h3>
- </span>
- </span>
- </a>
- <?php endwhile; ?>
- </div><!-- .glidecontenttoggler -->
- </div><!-- #headline -->
- <div id="list-categories">
- <p class="section-title"><?php _e( 'Latest News', 'wpbx' ) ?></p>
- <?php
- // Flag to indicate alternating columns
- $catLeftCol = true;
- $intCount = 0;
- // Determine how many posts to show per category
- $intPostCount = 5;
- // Retrieve a list of selected categories
- // Category Ajust $categories = get_categories("orderby=ID&order=asc&hide_empty=1&hierarchial=0&include=$front_cat_list");
- $categories = get_categories("hierarchial=0&include=$front_cat_list");
- // Iterate over each category
- foreach ($categories as $category)
- {
- // Retrieve a handful of posts for this category
- query_posts("cat=" . $category->cat_ID . "&showposts=$intPostCount&orderby=date&order=DESC");
- // Increment the debug counter
- $intCount++;
- ?>
- <!-- Loop: <?php echo $intCount; ?> -->
- <?php
- // Initialise the thumb display flag
- $catFirstPost = true;
- // Do we have any categories to display?
- while (have_posts())
- {
- // Advance the post queue
- the_post(); $do_not_duplicate = $post->ID;
- // Is this the first post in the category?
- if ($catFirstPost)
- {
- ?>
- <?php
- // Check whether we need to create the "row wrapper"
- if ($catLeftCol)
- {
- ?>
- <div class="entry-row clearfix">
- <?php
- }
- ?>
- <div id="<?php echo $category->slug; ?>-list" class="entry-list">
- <h2 class="entry-list-cat-title">
- <a href="<?php echo get_category_link($category->cat_ID); ?>" title="More articles in <?php echo $category->name; ?>"><?php echo $category->name; ?> »</a>
- </h2>
- <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>
- <div class="entry-list-meta">
- <span class="entry-list-date"><?php unset($previousday); printf( __( '%1$s', 'wpbx' ), the_date( 'D, M j Y', '', '', false ) ) ?></span>
- <span class="entry-meta-sep">|</span>
- <span class="entry-list-comm"><?php comments_popup_link( __( 'No Comments', 'wpbx' ), __( '1 Comment', 'wpbx' ), __( '% Comments', 'wpbx' ) ) ?></span>
- </div>
- <div class="entry-list-thumb">
- <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
- <?php
- $entry_preview = get_post_custom_values("post-image");
- if ( is_array($entry_preview) ) { ?>
- <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"/>
- <?php } else { ?>
- <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"/>
- <?php } ?>
- </a>
- </div>
- <div class="entry-list-content">
- <?php the_content_limit(150, ''); ?>
- </div>
- <p class="more-link">More in <?php echo $category->name; ?></p>
- <ul>
- <?php
- // First post display is complete
- $catFirstPost = false;
- the_post() == $do_not_duplicate;
- } // if ($catFirstPost)
- ?>
- <li class="clearfix">
- <span class="entry-star"><img src="<?php bloginfo('template_directory'); ?>/images/bullet-star.png" alt="#" /></span>
- <h3><a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>"><?php the_title(); ?></a></h3>
- <div class="entry-meta">
- <span class="entry-date"><?php unset($previousday); printf( __( '%1$s', 'wpbx' ), the_date( 'D, M j Y', '', '', false ) ) ?></span>
- <span class="entry-meta-sep">|</span>
- <span class="entry-comm"><?php comments_popup_link( __( 'No Comments', 'wpbx' ), __( '1 Comment', 'wpbx' ), __( '% Comments', 'wpbx' ) ) ?></span>
- </div>
- </li>
- <?php
- } // while (have_posts())
- ?>
- </ul>
- </div>
- <?php
- /*
- If we've run out of posts to display, we need to close the "row"
- */
- if (!$catLeftCol)
- {
- ?>
- </div><!-- .entry-row -->
- <?php
- }
- // Toggle the alternator
- $catLeftCol = !$catLeftCol;
- } // end foreach category
- // Account for odd number of posts
- if (!$catLeftCol)
- {
- ?>
- </div><!-- .entry-row -->
- <?php
- }
- ?>
- </div><!-- #list-categories -->
- </div><!-- #content -->
- </div><!-- #wrapper -->
- <?php get_sidebar() ?>
- <?php get_footer() ?>
Advertisement
Add Comment
Please, Sign In to add comment