Need help? Check out our Support site, then


Editing home page code to exclude a category

  1. Hello,

    I am looking to edit two pieces of code exclude a specific category from the homepage only, can you help?

    [code]
    <div id="latest-products">
    <h2>Latest Products</h2>
    <div class="product-container">
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('showposts=12'.'&paged='.$paged);
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <div class="product">
    " title="<?php printf( __('%s', 'sandbox'), the_title_attribute('echo=0') ) ?>">
    <img class="product-image" src="<?php $img_dir = get_post_custom_values('image'); bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $img_dir[0]; ?>&w=132&h=106&zc=1" width="132" height="106" />

    " title="<?php printf( __('%s', 'sandbox'), the_title_attribute('echo=0') ) ?>"><?php the_title() ?>
    <p class="rrp">RRP: <span>£<?php $rrp = get_post_custom_values('rrp'); echo $rrp[0]; ?></span></p>
    <p class="price">Our Price: <span>£<?php $price = get_post_custom_values('price'); echo $price[0]; ?></span></p>
    <div class="more-info">">More Info</div>
    </div><div id="latest-products">
    <h2>Latest Products</h2>
    <div class="product-container">
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('showposts=8&orderby=rand'.'&paged='.$paged);
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <div class="product">
    " title="<?php printf( __('%s', 'sandbox'), the_title_attribute('echo=0') ) ?>">
    <img class="product-image" src="<?php $img_dir = get_post_custom_values('image'); bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $img_dir[0]; ?>&w=132&h=106&zc=1" width="132" height="106" />

    " title="<?php printf( __('%s', 'sandbox'), the_title_attribute('echo=0') ) ?>"><?php the_title() ?>
    <p class="rrp">RRP: <span>£<?php $rrp = get_post_custom_values('rrp'); echo $rrp[0]; ?></span></p>
    <p class="price">Our Price: <span>£<?php $price = get_post_custom_values('price'); echo $price[0]; ?></span></p>
    <div class="more-info">">More Info</div>
    </div>
    [/code]

    and

    [code]

    <div id="best-sellers">
    <h3>Best Sellers</h3>
    <?php
    query_posts('posts_per_page=2&orderby=rand');
    while ( have_posts() ) : the_post() ?>
    <div class="product">
    " title="<?php printf( __('%s', 'sandbox'), the_title_attribute('echo=0') ) ?>">
    <img class="product-image" src="<?php $img_dir = get_post_custom_values('image'); bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $img_dir[0]; ?>&w=144&h=144&zc=1" width="144" height="144" />

    " title="<?php printf( __('%s', 'sandbox'), the_title_attribute('echo=0') ) ?>"><?php the_title() ?>
    <p class="rrp">RRP: <span>£<?php $rrp = get_post_custom_values('rrp'); echo $rrp[0]; ?></span></p>
    <p class="price">Our Price: <span>£<?php $price = get_post_custom_values('price'); echo $price[0]; ?></span></p>
    <div class="more-info">">More Info</div>

    </div>
    [/code]

  2. You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you'll find help at the WordPress.org forums.

    If you don't understand the difference between WordPress.com and WordPress.org, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It'll help people to answer your question.

    This is an automated message.

Topic Closed

This topic has been closed to new replies.

About this Topic