View Single Post
  #3  
Old October 22nd, 2012, 07:59 AM
tloenders tloenders is offline
 
Join Date: Jun 2012
Posts: 52
Default

Very helpful, thank you!

For future reference, here's how one could use this to build a random product image blob:

Code:
function my_awesome_product_loop( $total = 10 ) {

	global $wpdb;

	$table    = $wpdb->prefix . 'dfr_shop_products';
	$querystr = "SELECT * FROM $table ORDER BY RAND() LIMIT {$total}";
	$products = $wpdb->get_results( $querystr );

	if ( $products ) :
		foreach ( $products as $product ) :
			// Do stuff with Eric's feedback here, like:
			echo '<a href="' . dfr( 'app' )->url( 'click', $product ) . '" title="' . esc_attr( $product->name ) . '"><img src="' . dfr( 'app' )->url( 'image', $product ) . '" /></a>';
		endforeach;
	endif;
}