1. Home
  2. Car Demon Code Docs
  3. Actions
  4. cd_settings_action

cd_settings_action

This action gets called during the output of the Car Demon’s setting page. It can be used to add your own custom settings section.

do_action( ‘cd_settings_action’ );

add_action( 'cd_settings_action', 'my_settings' );
function my_settings() {

  $html = '<fieldset class="cd_admin_group cd_slug_option">';
     $html .= '<legend>+ ';
         $html .= __( 'My Settings Area', 'car-demon' );
     $html .= '</legend>';
     $html .= '<span class="cd_option_group">';
         $html .= 'This is my custom setting:';
         $html .= '<br />'
         $html .= '<input type="text" name="my_setting" value="' . $car_demon_options['my_setting'] . '" />';
     $html .= '</span>';
  $html .= '</fieldset>';

  echo $html;
}

The example above will add a new settings section on the Car Demon settings page. You can save your setting by using either the action ‘cd_settings_update_action‘ or the filter ‘cd_settings_filter‘.

Was this article helpful to you? Yes No

How can we help?