Setting API script is not showing in submenu
Question
I cannot recognize where is my problem. Anyone can check my script https://github.com/devrashed/devrashed/tree/main/themex%20plugin how to fix it.
setting_page.php
class settings_page
{
public function setup_sections() {
add_settings_section( 'our_first_section', 'My First Section Title', array( $this, 'section_callback' ), 'smashing_fields' );
add_settings_section( 'our_second_section', 'My Second Section Title', array( $this, 'section_callback' ), 'smashing_fields' );
add_settings_section( 'our_third_section', 'My Third Section Title', array( $this, 'section_callback' ), 'smashing_fields' );
}
public function section_callback( $arguments ) {
switch ($arguments['id'] ){
case 'our_first_section':
echo 'This is the first description here!';
break;
case 'our_second_section':
echo 'This one is number two';
break;
case 'our_third_section':
echo 'Third time is the charm!';
break;
}
}
public function setup_fields() {
add_settings_field( 'our_first_field', 'Field Name', array( $this, 'field_callback' ), 'smashing_fields', 'our_first_section' );
}
public function field_callback( $arguments ) {
echo '<input name="our_first_field" id="our_first_field" type="text" value="' . get_option( 'our_first_field' ) . '" />';
register_setting( 'smashing_fields', 'our_first_field' );
}
} /*END the setting class*/
?>
0
2 months
0 Answers
14 views
0
Leave an answer
You must login or register to add a new answer .