'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'; } $_configs[] = array( 'name' => 'section-posttype-' . $label, 'type' => 'section', 'section' => $parent_section, 'title' => isset( $post_type_object->labels->name ) ? $post_type_object->labels->name : ucfirst( $label ), 'priority' => 69, ); if ( ! in_array( $label, $ignore_archive_for_posttypes ) ) { $_configs[] = array( 'name' => 'archive-posttype-' . $label, 'type' => 'section', 'title' => __( 'Archive', 'astra' ) . ' ' . ucfirst( $label ), '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' ) . ' ' . ucfirst( $label ), '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();