Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I found the perfect slider for my needs, the only issue now that is that I cannot get it to work correctly. Problem that occur is that the function created doesn't work like it should. It ought to display three posts from a specific category but it ends up pushing more posts, presumedly via the loop in the function. And the slider effect won't work at all - probably because of this.

Check the url below. It's step 2, at the bottom. The code for slideshow_featured_posts. I have a feeling something is missing in the code, because I already see that we're missing php-tags in it. But I can't see what. Can anyone who knows this better than me help out?

http://www.paddsolutions.com/how-to-integrate-jquery-cycle-plugin-to-wordpress-theme/

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

replace slideshow_featured_posts function from that tutorial with this:

function slideshow_featured_posts() {

    $featured = 1; // Assuming that the name of the category ID number 1 is "Featured".
    $count = 3; // How many post to be shown as slides. Ideally, it should be more than 3 posts.
    add_filter('excerpt_length', 'hook_excerpt_featured_length');
    $Silder_query = new WP_Query(array('cat' => $featured, 'posts_per_page' => $count));
?>

<div class="list">
    <?php while ($Silder_query->have_posts()) : $Silder_query->the_post(); ?>
    <div class="item">
        <a class="image" href="<?php the_permalink(); ?>" title="Permanent Link to <?php the_title_attribute(); ?>">
        <?php the_post_thumbnail('slideshow'); ?>
        </a>
        <div class="meta">
            <h3><a href="<?php the_permalink(); ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
            <?php the_excerpt(); ?>
        </div>
        <div style="clear: both"></div>
    </div>
    <?php endwhile; ?>
</div>

<?php
    wp_reset_query();
    remove_filter('excerpt_length','hook_excerpt_featured_length');
}

everything else is ok.

share|improve this answer
    
Thanks Bainternet. I found that error a little bit earlier, but your solution will make it easier to modify this. Also, the person who made the tutorial had different names of the div id in different files. Found that after six hours. :) –  Mats Jul 23 '11 at 21:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.