Support

Account

Home Forums General Issues Display selected relationship as a String Reply To: Display selected relationship as a String

  • You need to move the get_field into the loop. You are performing this function outside the loop so the post ID is either wrong or non-existent when you call the function.

    
    // ... code before query & loop
    
          $args = array(
            'post_type' => 'evento',
            'post_status' => 'publish',
            'posts_per_page' => '-1',
            'meta_query' => array(
              array(
                'key' => 'fecha_del_evento',
                'compare' => '>=',
                'value' => $today,
                ),
              ),
            'meta_key' => 'fecha_del_evento',
            'orderby' => 'meta_value',
            'order' => 'ASC',
            );
    
          $query = new WP_Query($args);
          if ($query->have_posts()) :
            while ($query->have_posts()) : $query->the_post(); 
    
            // put your get_field call here
            $artista_evento = get_field('artista_del_evento');
            $today = current_time('Ymd');
    
            // the rest of your template code ...