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've been playing around with the jquery plugin Fancybox on this page, but for some reason since making a few changes my page seems to be displaying blog archives rather than the normal content it should be displaying.

I just wondered whether people have had a similar problem? There must be something I've done wrong for this page because all of the other page's content are displaying fine.

This is the code for the portfolio.php page, but it is outputting something completely different.

<?php

/* Template Name: Portfolio */ ?>

    <section>
        <?php include("includes/slideshow/slideshow-home.php"); ?>
    </section>
        <header>
            <div id="titleHeader" class="clear">
                <h2 class="entry-title"><?php the_title(); ?></h2>
            </div>
        </header>
        <section>
            <article>
                <div id="mainContent" class="clear">
                    <?php
                    /* Run the loop to output the page.
                     * If you want to overload this in a child theme then include a file
                     * called loop-page.php and that will be used instead.
                     */
                    get_template_part( 'loop', 'page' );
                    ?>
                    <ul id="portfolioContent">
                    <?php
                        $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10));
                    ?>
                    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                    <?php
                        $custom = get_post_custom($post->ID);
                    ?>
                    <li class="portfolioThumb"><a href="<?php echo get_permalink(); ?>" class="various2"><?php the_post_thumbnail('thumbnail'); ?></a></li>
                    <?php endwhile; ?>
                    </ul>
                </div>
             </article>
         </section>

         <section>
            <aside>
                <?php get_sidebar(); ?>
            </aside>
         </section>

    <?php get_footer(); ?>

Thanks,

Ash

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Does slideshow-home.php has a loop as well? You need to ensure that you reset the queries or rewind posts while using multiple Loops <?php wp_reset_query(); ?>

Multiple_Loops

Reset Query

share|improve this answer
    
slideshow-home.php doesn't have a loop at all. I seem to remember removing a wp_reset_query at some point, but it was a while ago and I can't remember - maybe not. Maybe its something to do with the fancybox jquery I've been editing :S –  remi90 Jun 13 '11 at 13:11
    
try adding it before $loop = new WP_Query –  Daniel Sachs Jun 13 '11 at 13:14
    
Sorry here's the link to the page: [ashleymosuro.com/newsite/porfolio] –  remi90 Jun 13 '11 at 13:16
    
Tried adding that, no luck. –  remi90 Jun 13 '11 at 13:18
    
Hard to know, but I have a feeling that because the post_type is portfolio and the page name is portfolio the function breaks. Did you register portfolio post_types with 'has_archive' => true ? and maybe this will help as well: Custom Post types Archives –  Daniel Sachs Jun 13 '11 at 13:40

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.