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.


/* Template Name: Portfolio */ ?>

        <?php include("includes/slideshow/slideshow-home.php"); ?>
            <div id="titleHeader" class="clear">
                <h2 class="entry-title"><?php the_title(); ?></h2>
                <div id="mainContent" class="clear">
                    /* 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">
                        $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10));
                    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                        $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; ?>

                <?php get_sidebar(); ?>

    <?php get_footer(); ?>




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(); ?>


Reset Query

| 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

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.