it is just a question of translating the jquery ui tabs markup into the appropriate wordpress functions. text is the_title() or the_excerpt(). images are the_post_thumbnail and so on. put this in your template where you want the slider to appear:
// Get any existing copy of our transient data
if ( false === ( $featured_query_results = get_transient( 'featured_query_results' ) ) ) {
// It wasn't there, so regenerate the data and save the transient
$args = array( 'numberposts' => 5, 'cat' => 11 );
$featured_query_results = get_posts( $args );
set_transient( 'featured_query_results', $featured_query_results );
}
global $post;
$tmp_post = $post;
//if there are posts returned then we'll loop through them
if($featured_query_results): ?>
<div id="featured">
<?php
$i=1;
$ul="<ul class="ui-tabs-nav">";
$divs="";
foreach( $featured_query_results as $post ) : setup_postdata($post);
//create the li nav element
$ul .= '<li><a href="#fragment-'.$i.'">'.get_the_post_thumbnail(get_the_ID(),"thumbnail").'<span>'.get_the_title().'</span></a></li>';
//create the div tab
$divs .= '<div id="fragment-'.$i.'">';
$divs .= get_the_post_thumbnail(get_the_ID(),"large");
$divs .= '<div class="info" >';
$divs .= '<h2><a href="'.get_permalink().'" >'.get_the_title().'</a></h2>';
$divs .= '<p>'.get_the_excerpt().'<a href="'.get_permalink().'" >read more</a></p>';
$divs .= '</div>';
$divs .= '</div>';
$i++;
endforeach;
//close out the unordered list
$ul .= '</ul><!--.ui-tabs-nav-->';
//echo out the results
echo $ul;
echo $divs;
?>
</div><!--#featured-->
<?php else: ?>
No matching posts found.
<?php endif; ?>
<?php $post = $tmp_post;
and this in your functions.php
// Create a simple function to delete our transient when posts are saved/created
function delete_featured_query_transient() {
delete_transient( 'featured_query_results' );
}
add_action( 'save_post', 'delete_featured_query_transient' );
do take note that i am using
$args = array( 'numberposts' => 5, 'cat' => 11 );
as the arguments for my query. you’ll want to use your own. and you might want to comment out the
set_transient( 'featured_query_results', $featured_query_results );
line while you are setting this up, b/c it will store the query’s results in a transient so that it doesn’t have to make the same query over and over. the transient is deleted when you write a new post (the function i said to put in functions.php) so it will always be up-to-date. you can always delete the transient by changing the delete function from the save_post hook to something that always runs, like init.