-1
Personal the code below it lists the results without repeating the post however need it to list containing the custom field with the following values:
meta_key "type"
meta_value "snack"
<?php
global $wpdb, $table_prefix;
$arquivos = $wpdb->get_results( '
SELECT *
FROM '.$table_prefix.'posts
WHERE
post_type = "arquivos"
AND post_status = "publish"
GROUP BY post_title
' );
?>
<?php foreach ( $arquivos as $key => $value ): ?>
<?php echo $value->post_title ?>
<?php endforeach ?>
Why are you using SQL directly in the code? You can do any query with Wp_query
– Kayo Bruno