Home Forums Front-end Issues Kindly help with display question Reply To: Kindly help with display question

  • @tmbond

    I think the issue is that you’re trying to reference a variable in single-event.php ($instructor_organization) which is defined in functions.php – this is because the variable is “out of scope” (see:

    You’ll need something like this in single-event.php:

    // OR
    echo get_field('instructor_organization');

    Both output the field value. Alternatively, you could do:

     // in functions.php:
    function get_instructor_org($post_id){
      $org = get_field('instructor_organization', $post_id);
      return $org;
    // then in single-event.php:
    // assuming you're in the Loop (i.e. $post variable is available)
    echo get_instructor_org($post->ID);

    Obviously the first way is easier, but the second gives you an idea of how variables can be passed to functions.