0

I have downloaded the following theme (http://demo.fabthemes.com/xenastore/) and i need a little help amending the index page.

At the moment it lists every product that i have created on the front page - what i would like is for it to only display a select few from a a certain "department" (they don't use categories) - say Featured. Below the 'Slider' and 'Deals'

The code is here but i am unsure which part to amend to only display that department and not everything on the site

<?php get_header(); ?>

<?php get_template_part( 'slider' ); ?>
<!-- Deals -->

<?php if (of_get_option('w2f_deal_show')== "1") { ?>

<div id="dealbanner">
    <div class="dealbox dbleft">
        <h1><?php echo of_get_option('w2f_lbanner_head'); ?></h1>
        <p><?php echo of_get_option('w2f_lbanner_text'); ?></p>
    </div>
    <div class="dealbox dbmid">
        <h1><?php echo of_get_option('w2f_mbanner_head'); ?></h1>
        <p><?php echo of_get_option('w2f_mbanner_text'); ?></p>
    </div>
    <div class="dealbox dbright">
        <h1><?php echo of_get_option('w2f_rbanner_head'); ?></h1>
        <p><?php echo of_get_option('w2f_rbanner_text'); ?></p>
    </div>
</div>
    <?php } ?> 
<!-- Store -->

<ul id="storefront">
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('post_type=product&paged='.$paged);
    ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

    <li class="storepanel">
        <div class="panelpic"><a href="<?php the_permalink() ?>">   <?php the_post_thumbnail( 'product_panel', array('class' => 'impanel') ); ?></a></div>
        <div class="paneldata">
            <h2> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a></h2>
            <p><?php echo get_the_term_list( $post->ID, 'department', '', ', ', '' ); ?></p>
            <div class="panelcopy"><p><?php wpe_excerpt('wpe_excerptlength_aside', ''); ?></p></div>
                <span class="sl-price"><?php echo get_post_meta($post->ID, 'WTF_price', true) ?></span>
                <span class="sl-buy"> <a href="<?php the_permalink() ?>"> More Info </a> </span>
        </div>
    </li>

    <?php endwhile; ?>
    <?php getpagenavi(); ?>
    <?php $wp_query = null; $wp_query = $temp;?>
</ul>


<?php get_footer(); ?>

Thank you in advance for your help

migrated from stackoverflow.com Mar 13 '13 at 18:01

This question came from our site for professional and enthusiast programmers.

0

You probably want to amend this line:

$wp_query->query('post_type=product&paged='.$paged);

To include some more limitations, like &department=Featured. I'm unaware of your whole project's code structure, so I can't advise exactly what you'd need to put.

  • You know what, that worked - thank you so much. I simply removed the &paged='.$paged part and replaced it with your code and that did the trick. Thanks again :) – Kipcab Mar 13 '13 at 16:44
  • I wouldn't remove that - do something like 'post_type=product&department=Featured&paged='.$paged instead. If my answer solved your problem, please mark it as the solution :) – Ivo Mar 13 '13 at 16:50
  • That seemed to break the site but replacing it seems to work with no problems else where. Do you know how i go about choosing the order i wish display the products in? - is that also within this code? – Kipcab Mar 13 '13 at 17:00
  • I'm sorry, I'm not familiar enough with wordpress or your site in particular to be able to give that specific help :( – Ivo Mar 13 '13 at 17:03
  • No worries - i'll have a play. The main thing was answered for me, thank you again. – Kipcab Mar 13 '13 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy