Displaying Child Categories in carousel

Basically I am making a carousel using carouFredSel that displays post. I have that part working fine but instead of showing an endless list of posts from a certain category I want it to just show posts from a child category on each “slide”. So basically the carousel is pulling a query of all children of a category, the posts shown in the carousel are only the post of one child category at a time (i.e. on load 3 posts are show from “Child A” when you hit next it loads the 4 posts of “Child B”)

This company is doing it well and uses both CarouFredSel and WordPress: HERE

Read More

Here is the documentation I changed the code from:HERE

Here is my code I am trying to work:

<div class="list_carousel">
    <?php
        $args = array(
            'type'                     => 'post',
            'child_of'                 => 0,
            'parent'                   => 'location',
            'orderby'                  => 'name',
            'order'                    => 'ASC',
            'hide_empty'               => 1,
            'hierarchical'             => 1,
            'taxonomy'                 => 'category',
            'pad_counts'               => false );
        $carouselPosts = new WP_Query($args);
        ?>
        <?php while ($carouselPosts->have_posts()) : $carouselPosts->the_post(); ?>


        <div id="title">
            <h1><?php get_the_category( $id ) ?></h1>
        </div>

        <div id="imagescroller">

            <div id="<?php get_the_category( $id ) ?>">
                <ul>
                    <li>
                        <?php the_post_thumbnail( $size, $attr ); ?> 
                    </li>
                </ul>

            </div>


            <div class="clearfix"></div>

            <a class="prev" id="prev2" href="#"><span>prev</span></a>
            <a class="next" id="next2" href="#"><span>next</span></a>
        </div>
    <?php endwhile; ?>
</div>

Related posts