WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
add Featured products to front page (1 post)

  1. kcwebz
    Member
    Posted 1 year ago #

    I have a template loaded which has a main page, I was wondering what code do I use to add featured products to the main page?

    This is what my code looks like.

    <?php get_header(); ?>
    	<div id="content" class="grid_18">
    		<div class="indent">
    
          <?php if( is_front_page() || is_home() ) { ?>
             <section id="slider">
    				<?php include_once(TEMPLATEPATH . '/slider.php'); ?>
             </section><!--#slider-->
          <?php } ?>
    
          <div class="box-2">
          	<div class="wrapper">
    
                <ul class="tabs">
                   <li><a href="#tab1">Latest</a></li>
                   <li><a href="#tab2">Features</a></li>
                </ul>
    
                <div class="inner">
                	<div class="wrapper">
                   <div class="tab_container">
                      <div id="tab1" class="tab_content">
                         <?php $wp_query = new WP_Query('post_type=post&posts_per_page=2&paged='.$paged ); ?>
                         <?php $posts_counter = 0; ?>
                         <ul class="posts">
                            <?php while ($wp_query->have_posts()) :$wp_query->the_post(); $posts_counter++; ?>
                               <li class="post-<?php echo $posts_counter; ?>">
                                  <strong><?php the_time('l, d F Y G:i'); ?></strong>
                                  <b><a href="<?php the_permalink(); ?>"><?php the_title(''); ?></a></b>
                                  <em>Posted by <span><?php the_author_posts_link() ?></span></em>
                                  <?php echo '<div class="featured-thumbnail">'; the_post_thumbnail(); echo '</div>'; ?>
                                  <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,36);?>
                                  <p><span><?php comments_popup_link('No comments', 'One comment', '% comments', 'comments-link', 'Comments are closed'); ?></span><i><a href="<?php the_permalink(); ?>">Read more</a></i></p>
                               </li>
                            <?php endwhile; ?>
                         </ul>
                      </div>
                      <div id="tab2" class="tab_content">
    							<?php $loop = new WP_Query(array('post_type' => 'features', 'posts_per_page' => 2)); ?>
                            <?php if ($loop->have_posts()): ?>
                            <ul class="posts">
                               <?php while ($loop->have_posts()) :	$loop->the_post(); ?>
                                  <li class="post-<?php echo $posts_counter; ?>">
                                     <strong><?php the_time('l, d F Y G:i'); ?></strong>
                                     <b><a href="<?php the_permalink(); ?>"><?php the_title(''); ?></a></b>
                                     <em>Posted by <span><?php the_author_posts_link() ?></span></em>
                                     <?php echo '<div class="featured-thumbnail">'; the_post_thumbnail(); echo '</div>'; ?>
                                     <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,36);?>
                                     <p><span><?php comments_popup_link('No comments', 'One comment', '% comments', 'comments-link', 'Comments are closed'); ?></span><i><a href="<?php the_permalink(); ?>">Read more</a></i></p>
                                  </li>
                               <?php endwhile; ?>
                            </ul>
                            <?php endif; ?>
                      </div>
                   </div>
                   </div>
                </div>
    
             </div>
          </div>
    
        </div>
    	</div><!--#content-->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I am wanting to put the featured products into <div class="box-2">

    http://wordpress.org/extend/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic