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.

The site url is: http://aachurch.org/reborn I'm trying to achieve multiple wp-query loops inside my index.php, showing different categories of posts. The first loop works but nothing shows up for the second one...

<?php
    break;
    case 'news_block':
    ?>

    <section id="latest-news">

        <div class="container">

            <?php if ($data['text_news_title']) { ?>
            <div class="icon-holder news">
                <?php echo do_shortcode(stripslashes($data['icon_news'])); ?>
            </div>

            <h1><?php echo $data['text_news_title']; ?></h1>
            <?php } ?>

            <p class="overview"><?php echo do_shortcode(stripslashes($data['textarea_news_overview'])); ?></p>

            <div id="articles">

                <?php
                global $data;

                $args2 = array ('post_type' => 'post', 'posts_per_page' => $data['select_news'], 'category_name' => 'multilingual');
                $loops = new WP_Query($args2);
                while ($loops->have_posts()) : $loops->the_post(); ?>

                <article class="article one-third column">

                    <div class="thumbnail">
                        <?php the_post_thumbnail('latest-news-thumb'); ?>
                    </div>

                    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

                    <div class="meta">
                    </div>

                    <?php the_excerpt(); ?>

                    <a class="view-article-btn" href="<?php the_permalink() ?>"><?php _e('Read more', 'nash'); ?> &rarr;</a>

                </article><!-- end article -->

                <?php endwhile;  ?>

            </div><!-- end #articles -->

        </div><!-- end .container -->

    </section><!-- end #latest-news -->



            <?php
    break;
    case 'ch_services_block':
    ?>

    <section id="ch_services">

        <div class="container">

            <?php if ($data['text_ch_services_title']) { ?>
            <div class="icon-holder ch_services">
                <?php echo do_shortcode(stripslashes($data['icon_ch_services'])); ?>
            </div>

            <h1><?php echo $data['text_ch_services_title']; ?></h1>
            <?php } ?>

            <p class="overview"><?php echo do_shortcode(stripslashes($data['textarea_ch_services_overview'])); ?></p>

            <div id="articles">

                <?php
                global $data;

                $args = array ('post_type' => 'post', 'posts_per_page' => $data['select_news'], 'category_name' => 'our-church');
                $loop = new WP_Query($args);
                while ($loop->have_posts()) : $loop->the_post(); ?>

                <article class="article one-third column">

                    <div class="thumbnail">
                        <?php the_post_thumbnail('latest-ch_services-thumb'); ?>
                    </div>

                    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

                    <div class="meta">
                    </div>

                    <?php the_excerpt(); ?>

                    <a class="view-article-btn" href="<?php the_permalink() ?>"><?php _e('Read more', 'nash'); ?> &rarr;</a>

                </article><!-- end article -->

                <?php endwhile; ?>

            </div><!-- end #articles -->

        </div><!-- end .container -->

    </section><!-- end #latest-news -->

    <?php break; }
    } endif; ?>

</div><!-- end #main -->

I read posts about resetting the query with <?php wp_reset_query(); ?> but to no avail. I've looked at the other posts on here and on codex, but still can't seem to figure out what i'm doing wrong...

Any insight to this would be amazing.. thanks!

share|improve this question
    
Do you have debugging information? What does "nothing shows" mean? Does the Loop run at all and you get the html but no dynamic content or does the Loop never run? –  s_ha_dum Apr 5 '13 at 19:47
    
does the category slug 'our-church' exist? does the 'ch_services_block' happen? what is the full code of the template? –  Michael Apr 5 '13 at 21:49
    
Yes, the slug 'our-church' does exist. Nothing shows as in no dynamic content is added. Looks like the container is being created but nothing is being pulled from the query.. Here is the full code of the index.php pastebin.com/PUD9xTN2 –  Matt Taylor Apr 5 '13 at 22:36
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.