1. function feature_scripts(){
  2.     if ( is_home() || is_front_page() ) {
  3.             wp_deregister_script('jquery');
  4.             wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, '1.4.2');
  5.             wp_enqueue_script('jquery');
  6.             wp_enqueue_script('jquery-tools', 'http://cdn.jquerytools.org/1.2.4/full/jquery.tools.min.js');
  7.     }
  8. }
  9.  
  10. add_action('template_redirect', 'feature_scripts');
  11.  
  12.  
  13. //support thumbnails
  14. add_theme_support( 'post-thumbnails' );
  15.  
  16.  
  17. $ids = array(); // here we'll save the post id's that are listed in the featured area. It's a global variable
  18.  
  19. function featured_posts(){
  20.     if (is_home() || is_front_page()) {
  21.         global $ids; //telling php to use the global variable
  22.  
  23.         $my_query = new WP_Query('tag=featured&showposts=4');
  24.  
  25.         echo '<div id="featured-holder"><div id="featured-content" >';
  26.         $feat_class = array();
  27.         $nav = '';
  28.         while ($my_query->have_posts()) : $my_query->the_post();
  29.                 $feat_class = array();
  30.                 // Category for the post queried
  31.                 foreach ( (array) get_the_category() as $cat )
  32.                     $feat_class[] = 'category-' . $cat->slug;
  33.                     $feat_class = join(" ", $feat_class);
  34.                 ?>
  35.                 <div class="clearfix slide">
  36.            
  37.                 <?php the_post_thumbnail('medium'); ?>
  38.                 <?php thematic_postheader(); ?>
  39.                     <?php the_excerpt(); ?>
  40.                 </div>
  41.         <?php
  42.  
  43.         $ids[] = get_the_ID();
  44.        
  45.                 //this will store the list elements that will be the feature's nav
  46.         $thumb = get_the_post_thumbnail( $post->ID, 'thumbnail' );
  47.         $nav .= '<li><a href="#">' .  $thumb . get_the_title() . '</a></li>'."\n";
  48.        
  49.        
  50.         endwhile;
  51.        
  52.         echo '</div>';
  53.        
  54.                 //echoing the feature nav... outside #featured-content
  55.         echo '<div style="clear:both"></div>'."\n". '<div id="nav" class="clearfix"><ul>' . $nav . '</ul></div>';
  56.        
  57.         echo '</div>';
  58.        
  59.         // next will be the jQuery for the jQuery tabs slideshow
  60.  
  61. ?> 
  62.        
  63.     <script language="JavaScript">
  64.         // What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
  65.         jQuery.noConflict();
  66.  
  67.         jQuery(document).ready(function($) {
  68.  
  69.             $("#nav ul").tabs("#featured-content > div.slide", {
  70.  
  71.             // enable "cross-fading" effect
  72.             effect: 'fade',
  73.             fadeOutSpeed: "slow",
  74.             interval:   3000,
  75.  
  76.             // start from the beginning after the last tab
  77.             rotate: true
  78.  
  79.             // use the slideshow plugin. It accepts its own configuration
  80.             }).slideshow( {
  81.                 autoplay: true,
  82.             });
  83.        
  84.         });
  85.  
  86.     </script>      
  87.        
  88.        
  89. <?php   }
  90. }
  91. add_action('thematic_belowheader','featured_posts');
  92.  
  93.  
  94. // We'll remove the main thematic loop because we recreated it in the above function.
  95. function remove_thematic_indexloop(){
  96.     remove_action('thematic_indexloop','thematic_index_loop');
  97. }
  98. add_action('init','remove_thematic_indexloop');
  99.  
  100. function child_indexloop(){
  101.     global $ids; //telling php to use the global variable
  102.  
  103.     //Recreate the main loop and exclude the posts that have been displayed
  104.         while ( have_posts() ) : the_post() ?>
  105.  
  106.             <?php
  107.  
  108.             // If an ID has been listed in the above list we won't list it again.
  109.             if (!in_array(get_the_ID(), $ids)) { ?>
  110.  
  111.                 <div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
  112.                     <?php thematic_postheader(); ?>
  113.                     <div class="entry-content">
  114.                     <?php thematic_content(); ?>
  115.  
  116.                     <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
  117.                     </div>
  118.                     <?php thematic_postfooter(); ?>
  119.                 </div><!-- .post -->
  120.  
  121.                     <?php comments_template();
  122.  
  123.                     if ($count==$thm_insert_position) {
  124.                             get_sidebar('index-insert');
  125.                     }
  126.                     $count = $count + 1;
  127.             }
  128.         endwhile;
  129.        
  130.  
  131.  
  132. }
  133. add_action('thematic_indexloop', 'child_indexloop');