labels->name ) ? $post_type_obj->labels->name : ucfirst( $label ); } /** * Register Posts Structures Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 4.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); if ( ! empty( $post_types ) ) { $_configs = array( array( 'name' => 'section-posts-structure', 'type' => 'section', 'priority' => 69, 'title' => __( 'Custom Post Types', 'astra' ), ), ); $ignore_single_for_posttypes = array( 'post', 'product' ); $ignore_archive_for_posttypes = array( 'post', 'product' ); /** * Individual post types main section. */ foreach ( $post_types as $index => $label ) { $post_type_object = get_post_type_object( $label ); $parent_section = 'section-posts-structure'; if ( 'download' === $label ) { $parent_section = 'section-edd-group'; } if ( 'llms_membership' === $label ) { $parent_section = 'section-lifterlms'; } if ( 'groups' === $label || 'sfwd-topic' === $label || 'sfwd-lessons' === $label || 'sfwd-courses' === $label ) { $parent_section = 'section-learndash'; } $section_title = self::astra_get_dynamic_section_title( $post_type_object, $label ); if ( 'sc_product' === $label ) { $_configs[] = array( 'name' => 'section-posttype-' . $label, 'type' => 'section', 'title' => $section_title, 'priority' => 69, ); } else { $_configs[] = array( 'name' => 'section-posttype-' . $label, 'type' => 'section', 'section' => $parent_section, 'title' => $section_title, 'priority' => 69, ); } if ( ! in_array( $label, $ignore_archive_for_posttypes ) ) { $_configs[] = array( 'name' => 'archive-posttype-' . $label, 'type' => 'section', 'title' => __( 'Archive', 'astra' ) . ' ' . $section_title, 'section' => 'section-posttype-' . $label, 'priority' => 5, ); } if ( ! in_array( $label, $ignore_single_for_posttypes ) ) { $_configs[] = array( 'name' => 'single-posttype-' . $label, 'type' => 'section', 'title' => __( 'Single', 'astra' ) . ' ' . $section_title, 'section' => 'section-posttype-' . $label, 'priority' => 10, ); } } $configurations = array_merge( $configurations, $_configs ); } return $configurations; } } /** * Kicking this off by creating new object. */ new Astra_Posts_Structures_Configs();