Display products
-
I have followed all the information, but my products won’t display. Do you have any idea?
page.php:
$posts = get_posts( array( 'post_type' => 'product' ) ); foreach( $posts as $post ) { setup_postdata( $post ); the_title(); the_post_thumbnail(); the_content(); if( class_exists( 'LDB_Affiliate_Press' ) ) { $ap = new LDB_Affiliate_Press; echo $ap->AP_getPrices( true ); } }
functions.php:
add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_category() && $query->is_main_query() ) $query->set( 'post_type', array( 'post', 'product' ) ); return $query; }
on the page in wordpress CMS:
<?php my_get_posts();?>
Is this allright?
I have two pages with products and prices, but on my website (https://hiphopsisters.nl/?page_id=386) I get the warning: No prices were found.
Can you help me? Thanks in advance
- The topic ‘Display products’ is closed to new replies.