Filter uncanny-automator

wwlc_filter_company_field_form_label

Filters the label for the company name field in Wholesale Pro forms.

add_filter( 'wwlc_filter_company_field_form_label', $callback, 10, 1 );

Description

Filters the label displayed for the "Company Name" field in Wholesale Lead Capture forms. Developers can modify this label to customize form language, enabling dynamic text based on user roles or other conditions.


Usage

add_filter( 'wwlc_filter_company_field_form_label', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

<?php
/**
 * Example of using the wwlc_filter_company_field_form_label hook.
 *
 * This function demonstrates how to modify the default label for the company name field
 * in the Wholesale Lead Conquest form. In this example, we'll append "(Optional)" if
 * the company name field is not set as required in the WordPress options.
 *
 * @param string $label The default label for the company name field.
 * @return string The modified label for the company name field.
 */
add_filter( 'wwlc_filter_company_field_form_label', 'my_custom_company_field_label', 10, 1 );

function my_custom_company_field_label( $label ) {
    // Check if the company name field is marked as required in settings.
    $is_company_field_required = ( get_option( 'wwlc_fields_require_company_name_field' ) == 'yes' );

    // If the field is not required, append "(Optional)" to the label.
    if ( ! $is_company_field_required ) {
        $label .= ' (Optional)';
    }

    // Return the potentially modified label.
    return $label;
}
?>

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/integrations/wholesale-suite/helpers/wholesale-suite-helpers.php:110

'label'       => apply_filters( 'wwlc_filter_username_form_label', esc_html__( 'Username', 'uncanny-automator' ) ),
				'type'        => 'text',
				'required'    => true,
				'active'      => ( get_option( 'wwlc_fields_username_active' ) == 'yes' ) ? true : false,
				'placeholder' => ( get_option( 'wwlc_fields_username_placeholder' ) ) ? get_option( 'wwlc_fields_username_placeholder' ) : '',
			),
			'wwlc_company_name' => array(
				'label'       => apply_filters( 'wwlc_filter_company_field_form_label', esc_html__( 'Company name', 'uncanny-automator' ) ),
				'type'        => 'text',
				'required'    => ( get_option( 'wwlc_fields_require_company_name_field' ) == 'yes' ) ? true : false,
				'active'      => ( get_option( 'wwlc_fields_activate_company_name_field' ) == 'yes' ) ? true : false,
				'placeholder' => ( get_option( 'wwlc_fields_company_field_placeholder' ) ) ? get_option( 'wwlc_fields_company_field_placeholder' ) : '',
			),
			'wwlc_country'      => array(
				'label'    => apply_filters( 'wwlc_filter_country_field_form_label', esc_html__( 'Country', 'uncanny-automator' ) ),


Scroll to Top