0

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/

1 Answer 1

1

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.

1
  • 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. :) Commented Jul 23, 2011 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.