This topic contains 3 reply and 2 voices, and was last updated by Sk 6 years, 3 months ago
Viewing 3 Posts - 1 through 3 (of 3 total)
Author Posts
May 12, 2014 at 5:04 pm 20336
Sk I do child theme. Want to add into front page random products (like products archive page):

	<!-- RANDOM PRODUCTS -->

	<ul class="products">
	<?php query_posts('post_type=product&post_status=publish&orderby=rand'); ?>

	<?php while (have_posts()) : the_post(); ?>

		<?php wc_get_template_part( 'content', 'product' ); ?>

	<?php endwhile; ?>
	</ul>

	<!-- RANDOM PRODUCTS -->
This code working. On archive products page all correct (in lines of four products and correct styles). But on front page output is not correct (I think, that some styles needed). What need to add for correct output everywhere?
May 12, 2014 at 5:35 pm 20338
Sk Sk

hello Artem,

use this query please. it should work.

<?php $args = array(
        'post_type'             => 'product',
        'post_status'           => 'publish',
        'orderby'               => 'rand'
    );
 $dokan_product_query = new WP_Query( apply_filters( 'dokan_random_product_query', $args ) ); ?>

<?php while ( $dokan_product_query->have_posts() ) : $dokan_product_query->the_post(); ?>
       <?php wc_get_template_part( 'content', 'product' ); ?>
<?php endwhile; ?>

thank you

May 12, 2014 at 5:48 pm 20340
Artem Artem

Ok, but problem not in this.

How I can output query results (random products) in front page with styles from archive page? Style <ul class="products"> not working on front page… and output without correct styles.

May 12, 2014 at 6:21 pm 20346
Sk Sk

ok, edit your child themes css file for style. it will overwrite main styles.

if you are not good in css please hire an expert

thank you.

Viewing 3 Posts - 1 through 3 (of 3 total)