Use the different variable names on the place of $posts
. You should not use any of the global variable names for avoiding such incidents.
Also, call wp_reset_query()
after fetching your data. This will reset the query to default.
For the list of global variables please refer to this link.
Edit your query to read like this:
$posts_list = get_posts(array(
'post_type' => 'obres',
'posts_per_page' => -1,
'meta_key' => 'any',
'orderby' => 'meta_value_num',
'order' => 'DESC',));
if( $posts_list ):
while ( have_posts() ) : the_post();