dimanche 12 juin 2016

Created a plugin for wordpress and need to add an option tab to woocommerce

Am creating a plugin for worpdress. Did all the stuff and now want to add an Doing something like this from this instruction:

add_filter( 'woocommerce_get_sections_api', 'some_function_to_add_tab' );

function some_function_to_add_tab( $sections ) {
    $sections['some_settings'] = __( 'Some Settings', 'text-domain' );
    return $sections;
}

add_filter( 'woocommerce_get_settings_api', 'some_tab_settings', 10, 2 );

function some_tab_settings( $settings, $current_section ) {
    if ($current_section == 'some_settings') {
        echo "settings here";
    } else {
        return $settings;
    }
}

and getting errors

Warning: Missing argument 2 for some_tab_settings() in C:\OpenServer\domains\wp-dev\wp-content\plugins\some-plugin\some_plugin.php on line 30

Notice: Undefined variable: current_section in C:\OpenServer\domains\wp-dev\wp-content\plugins\some-plugin\some_plugin.php on line 31

add_filter( 'woocommerce_get_settings_api', 'some_tab_settings', 10, 2 ); Line: 30

function some_tab_settings( $settings, $current_section ) { Line: 31



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire