function feature_scripts(){
if ( is_home() || is_front_page() ) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, '1.4.2');
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-tools', 'http://cdn.jquerytools.org/1.2.4/full/jquery.tools.min.js');
}
}
add_action('template_redirect', 'feature_scripts');
//support thumbnails
add_theme_support( 'post-thumbnails' );
$ids = array(); // here we'll save the post id's that are listed in the featured area. It's a global variable
function featured_posts(){
if (is_home() || is_front_page()) {
global $ids; //telling php to use the global variable
$my_query = new WP_Query('tag=featured&showposts=4');
echo '<div id="featured-holder"><div id="featured-content" >';
$feat_class = array();
$nav = '';
while ($my_query->have_posts()) : $my_query->the_post();
$feat_class = array();
// Category for the post queried
foreach ( (array) get_the_category() as $cat )
$feat_class[] = 'category-' . $cat->slug;
$feat_class = join(" ", $feat_class);
?>
<div class="clearfix slide">
<?php the_post_thumbnail('medium'); ?>
<?php thematic_postheader(); ?>
<?php the_excerpt(); ?>
</div>
<?php
$ids[] = get_the_ID();
//this will store the list elements that will be the feature's nav
$thumb = get_the_post_thumbnail( $post->ID, 'thumbnail' );
$nav .= '<li><a href="#">' . $thumb . get_the_title() . '</a></li>'."\n";
endwhile;
echo '</div>';
//echoing the feature nav... outside #featured-content
echo '<div style="clear:both"></div>'."\n". '<div id="nav" class="clearfix"><ul>' . $nav . '</ul></div>';
echo '</div>';
// next will be the jQuery for the jQuery tabs slideshow
?>
<script language="JavaScript">
// What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
jQuery.noConflict();
jQuery(document).ready(function($) {
$("#nav ul").tabs("#featured-content > div.slide", {
// enable "cross-fading" effect
effect: 'fade',
fadeOutSpeed: "slow",
interval: 3000,
// start from the beginning after the last tab
rotate: true
// use the slideshow plugin. It accepts its own configuration
}).slideshow( {
autoplay: true,
});
});
</script>
<?php }
}
add_action('thematic_belowheader','featured_posts');
// We'll remove the main thematic loop because we recreated it in the above function.
function remove_thematic_indexloop(){
remove_action('thematic_indexloop','thematic_index_loop');
}
add_action('init','remove_thematic_indexloop');
function child_indexloop(){
global $ids; //telling php to use the global variable
//Recreate the main loop and exclude the posts that have been displayed
while ( have_posts() ) : the_post() ?>
<?php
// If an ID has been listed in the above list we won't list it again.
if (!in_array(get_the_ID(), $ids)) { ?>
<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
<?php thematic_postheader(); ?>
<div class="entry-content">
<?php thematic_content(); ?>
<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
</div>
<?php thematic_postfooter(); ?>
</div><!-- .post -->
<?php comments_template();
if ($count==$thm_insert_position) {
get_sidebar('index-insert');
}
$count = $count + 1;
}
endwhile;
}
add_action('thematic_indexloop', 'child_indexloop');