Astra_Posts_Structures_Configs::register_configuration( Array $configurations, WP_Customize_Manager $wp_customize )

Register Posts Structures Customizer Configurations.


Description


Parameters

$configurations

(Array) (Required) Astra Customizer Configurations.

$wp_customize

(WP_Customize_Manager) (Required) instance of WP_Customize_Manager.


Return

(Array) Astra Customizer Configurations with updated configurations.


Source

File: inc/modules/posts-structures/customizer/class-astra-posts-structures-configs.php

	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';
				}

				$_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;
	}

Changelog

Changelog
Version Description
4.0.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.