• I’m using a Woocommerce theme that has a post at the top of the page, then a featured products section, and a recent products section at the bottom.

    I want to remove the recent products section and replace it with a second loop to show post excerpts but excluding the category of the post already shown at the top of the page.

    So far I’ve only been getting errors. The code I’m using for the second loop is as follows:

    <?php query_posts('cat=-83'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    The code I’m using to actually display the posts is the same as that used to display the “featured post” at at the top of the page, which is:

    <article>
    <?php post_class(); ?>>
    <?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] != 'content' ) { woo_image( 'width=' . $woo_options['woo_thumb_w'] . '&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail ' . $woo_options['woo_thumb_align'] ); } ?>
    <header>
    <h2>
    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </h2>
    </header>
    <section class="entry">
    <?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] == 'content' ) { the_content( __( 'Continue Reading →', 'woothemes' ) ); } else { the_excerpt(); } ?></section>
    </article><!-- /.post -->

    So the code in its entirety is as follows:

    <?php query_posts('cat=-83'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <article <?php post_class(); ?>>
    <?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] != 'content' ) { woo_image( 'width=' . $woo_options['woo_thumb_w'] . '&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail ' . $woo_options['woo_thumb_align'] ); } ?>
    <header>
    <h2>
    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </h2>
    </header>
    <section class="entry">
    <?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] == 'content' ) { the_content( __( 'Continue Reading →', 'woothemes' ) ); } else { the_excerpt(); } ?></section>
    </article><!-- /.post -->
    <?php endwhile; ?>

    This is the error I’m getting:
    Parse error: syntax error, unexpected $end in...

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘secondary loop on home page’ is closed to new replies.