• Resolved khalidslife

    (@khalidslife)


    Hello,

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

    <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>

    and

    <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>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Exclude a category from homepage’ is closed to new replies.