Show posts on front end, even if they are already visible in admin

When importing products, they need to have the meta_key “total_sales” set to 0. Otherwise, use this code:

[php]

include_once ‘../wp-config.php’;

$query = "SELECT * FROM wp_posts WHERE post_type=’product’";
$products = $wpdb->get_results($query);

foreach ($products as $product){

$q = "SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘total_sales’ AND post_id = " . $product->ID;
$x = $wpdb->get_results($q);
if (!$x){
$query = "INSERT INTO wp_postmeta (`post_id`, `meta_key`, `meta_value`)
VALUES ($product->ID, ‘total_sales’, ‘0’);";

$x = $wpdb->query($query);
}

}

[/php]