Support

Account

Home Forums General Issues Add a condition for post objects Reply To: Add a condition for post objects

  • 
      $projects = get_field( 'display_featured_projects');
      if ($projects) {
        foreach ($projects as $post) {
          setup_postdata($post);
          $post_type = get_post_type($post);
            if ($post_type == 'custom_post_type_one') {
              // do this
            } else {
              // do that
            }
        } // end foreach
        wp_reset_postdata();
      } end if projects