WC_Widget_Layered_Nav::init_settings()publicWC 1.0

Init settings after post types are registered.

Метод класса: WC_Widget_Layered_Nav{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Widget_Layered_Nav = new WC_Widget_Layered_Nav();
$WC_Widget_Layered_Nav->init_settings();

Код WC_Widget_Layered_Nav::init_settings() WC 8.7.0

public function init_settings() {
	$attribute_array      = array();
	$std_attribute        = '';
	$attribute_taxonomies = wc_get_attribute_taxonomies();

	if ( ! empty( $attribute_taxonomies ) ) {
		foreach ( $attribute_taxonomies as $tax ) {
			if ( taxonomy_exists( wc_attribute_taxonomy_name( $tax->attribute_name ) ) ) {
				$attribute_array[ $tax->attribute_name ] = $tax->attribute_name;
			}
		}
		$std_attribute = current( $attribute_array );
	}

	$this->settings = array(
		'title'        => array(
			'type'  => 'text',
			'std'   => __( 'Filter by', 'woocommerce' ),
			'label' => __( 'Title', 'woocommerce' ),
		),
		'attribute'    => array(
			'type'    => 'select',
			'std'     => $std_attribute,
			'label'   => __( 'Attribute', 'woocommerce' ),
			'options' => $attribute_array,
		),
		'display_type' => array(
			'type'    => 'select',
			'std'     => 'list',
			'label'   => __( 'Display type', 'woocommerce' ),
			'options' => array(
				'list'     => __( 'List', 'woocommerce' ),
				'dropdown' => __( 'Dropdown', 'woocommerce' ),
			),
		),
		'query_type'   => array(
			'type'    => 'select',
			'std'     => 'and',
			'label'   => __( 'Query type', 'woocommerce' ),
			'options' => array(
				'and' => __( 'AND', 'woocommerce' ),
				'or'  => __( 'OR', 'woocommerce' ),
			),
		),
	);
}