jacko_162 Posted December 12, 2012 Share Posted December 12, 2012 i have the following code; <?php /** * Homepage Shop Panel */ /** * The Variables * * Setup default variables, overriding them if the "Theme Options" have been saved. */ global $woocommerce; $settings = array( 'thumb_w' => 100, 'thumb_h' => 100, 'thumb_align' => 'alignleft', 'shop_area' => 'false', 'shop_area_entries' => 3, 'shop_area_title' => '', 'shop_area_message' => '', 'shop_area_link_text' => 'View all our products', ); $settings = woo_get_dynamic_values( $settings ); ?> <section id="shop-home" class="home-section fix"> <ul class="recent products"> <?php $number_of_products = $settings['shop_area_entries']; $args = array( 'post_type' => 'product', 'posts_per_page' => $number_of_products, 'meta_query' => array( array('key' => '_visibility','value' => array('catalog', 'visible'),'compare' => 'IN')) ); $first_or_last = 'first'; $loop = new WP_Query( $args ); $count = 0; global $post; while ( $loop->have_posts() ) : $loop->the_post(); $_product = &new WC_Product( $loop->post->ID ); $count++; ?> <li class="product <?php if ( $count % 3 == 0 ) { echo 'last'; } ?>"> <a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>"> <div class="img-wrap"> <?php woocommerce_show_product_sale_flash( $post, $_product ); ?> <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_thumbnail'); else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_catalog_image_width').'px" height="'.$woocommerce->get_image_size('shop_catalog_image_height').'px" />'; ?> </div> </a> <h3><a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>"><?php the_title(); ?></a></h3> <span class="price"><?php echo $_product->get_price_html(); ?></span> <?php woocommerce_template_loop_add_to_cart( $loop->post, $_product ); ?> <div class="fix"></div> </li> <?php if ( $count % 3 == 0 ) { echo '<li class="fix clear"></li>'; } ?> <?php endwhile; ?> </ul><!--/ul.recent--> </section> <?php wp_reset_query(); ?> upon loading it shows my latest products, it shows them in 3 columns then starts a new row with 3 columns and so on. can i get it to show 4 or 5 products per row instead? if so what part do i need to understand and edit? thanks Link to comment https://forums.phpfreaks.com/topic/271879-php-code-shows-rows-can-i-change-amount-of-products-per-row/ Share on other sites More sharing options...
Jessica Posted December 12, 2012 Share Posted December 12, 2012 Did you try looking for the number 3, and changing it to 4 or 5? Link to comment https://forums.phpfreaks.com/topic/271879-php-code-shows-rows-can-i-change-amount-of-products-per-row/#findComment-1398823 Share on other sites More sharing options...
jacko_162 Posted December 12, 2012 Author Share Posted December 12, 2012 Did you try looking for the number 3, and changing it to 4 or 5? yes but no luck. Link to comment https://forums.phpfreaks.com/topic/271879-php-code-shows-rows-can-i-change-amount-of-products-per-row/#findComment-1398830 Share on other sites More sharing options...
jacko_162 Posted December 12, 2012 Author Share Posted December 12, 2012 aaah something in css was stopping it showing correctly. problem solved. Link to comment https://forums.phpfreaks.com/topic/271879-php-code-shows-rows-can-i-change-amount-of-products-per-row/#findComment-1398831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.