array( 'al_product' ), 'show' => array( '' ) ); } /** * Returns attributes field settings * * @return type */ function get_attributes_table_settings() { $settings = wp_parse_args( get_option( 'attributes_table_settings' ), default_attributes_table_settings() ); return $settings; } /** * Shows attributes field settings fields * */ function attributes_table_settings() { $post_types = get_post_types( array( 'publicly_queryable' => true ), 'objects' ); unset( $post_types[ 'attachment' ] ); echo '

' . __( 'Settings', 'attributes-table' ) . ' - impleCode Attributes Table

'; echo '

' . __( 'General Attributes Table Settings', 'attributes-table' ) . '

'; echo '
'; settings_fields( 'ic_attributes_table' ); $attributes_table_settings = get_attributes_table_settings(); echo '

' . __( 'Enable Attributes for', 'attributes-table' ) . ':

'; $checked = in_array( 'page', $attributes_table_settings[ 'enabled' ] ) ? 'checked' : ''; echo ' ' . __( 'Pages', 'attributes-table' ) . '
'; foreach ( $post_types as $type_key => $type_obj ) { if ( strpos( $type_key, 'al_product' ) !== 0 ) { $checked = in_array( $type_key, $attributes_table_settings[ 'enabled' ] ) ? 'checked' : ''; echo ' ' . $type_obj->labels->name . '
'; } } echo '

' . __( 'Show Attributes Automatically on', 'attributes-table' ) . ':

'; $checked = in_array( 'page', $attributes_table_settings[ 'show' ] ) ? 'checked' : ''; echo ' ' . __( 'Pages', 'attributes-table' ) . '
'; foreach ( $post_types as $type_key => $type_obj ) { if ( strpos( $type_key, 'al_product' ) !== 0 ) { $checked = in_array( $type_key, $attributes_table_settings[ 'show' ] ) ? 'checked' : ''; echo ' ' . $type_obj->labels->name . '
'; } } echo '
' . __( 'You can also display attributes with', 'attributes-table' ) . ':
  1. ' . sprintf( __( '%s shortcode placed in content.', 'attributes-table' ), '' . esc_html( '[attributes_table]' ) . '' ) . '
  2. ' . sprintf( __( '%s code placed in template file.', 'attributes-table' ), '' . esc_html( '' ) . '' ) . '
'; echo '

'; echo '
'; if ( !defined( 'AL_BASE_PATH' ) ) { echo ''; $info = __( 'The table below controls the attributes default values.', 'attributes-table' ); attributes_settings_fields( $info ); } echo ''; }