Fields

<?php

/**
 * 1. You can find all fields in wp-content/plugins/workforce/src/Workforce/Types
 * 2. Never edit plugin's source code
 * 3. Place your own source code into functions.php in child theme or own plugin
 */

// Add new field
function mytheme_company_add_field() {
    $metabox = CMB2_Boxes::get( 'company' );

    $metabox->add_field( [
        'name'      => esc_html__( 'City', 'mytheme' ),
        'id'        => WORKFORCE_COMPANY_PREFIX . 'city',
        'type'      => 'text',
    ] );
}
add_action( 'cmb2_init', 'mytheme_company_add_field' );

// Remove field
function mytheme_company_remove_field() {
    $metabox = CMB2_Boxes::get( 'company' );
    $metabox->remove_field( WORKFORCE_COMPANY_PREFIX . 'city' );
}
add_action( 'cmb2_init', 'mytheme_company_remove_field' );

Complete documentation how to work with the fields can be found in official CMB2 plugin documentation.

results matching ""

    No results matching ""