/** * Render section and it's controls * * @param WP_Fields_API_Section $section Section object * @param null|int $item_id Item ID * @param null|string $object_name Object name */ public function render_section($section, $item_id = null, $object_name = null) { /** * @var $wp_fields WP_Fields_API */ global $wp_fields; // Pass $object_name and $item_id to Section $section->object_name = $object_name; $section->item_id = $item_id; $controls = $wp_fields->get_controls($this->object_type, $section->object_name, $section->id); if (!empty($controls)) { $content = $section->get_content(); ?> <div class="fields-form-<?php echo esc_attr($this->object_type); ?> -section section-<?php echo esc_attr($section->id); ?> -wrap fields-api-section"> <?php if ($content && $section->display_title) { ?> <h3><?php echo $content; ?> </h3> <?php } $this->render_controls($controls, $item_id, $section->object_name); ?> </div> <?php } }