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?



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'); ?>
        <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 style="clear: both"></div>
    <?php endwhile; ?>


everything else is ok.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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