settings_key = WP_ConvertKit::SETTINGS_PAGE_SLUG; $this->name = 'general'; $this->title = 'General Settings'; $this->tab_text = 'General'; parent::__construct(); } /** * Register and add settings */ public function register_fields() { add_settings_field( 'api_key', 'API Key', array($this, 'api_key_callback'), $this->settings_key, $this->name ); add_settings_field( 'api_secret', 'API Secret', array($this, 'api_secret_callback'), $this->settings_key, $this->name ); add_settings_field( 'default_form', 'Default Form', array($this, 'default_form_callback'), $this->settings_key, $this->name, $this->api->get_resources('forms') ); } /** * Prints help info for this section */ public function print_section_info() { ?>
Choosing a default form will embed it at the bottom of every post or page (in single view only) across your site. If you wish to turn off form embedding or select a different form for an individual post or page, you can do so within the ConvertKit meta box on the editing form.
The default form can be inserted into the middle of post or page content
by using the [convertkit] shortcode.
Get your ConvertKit API Secret. This setting is required to unsubscribe subscribers.
'; echo $html; } /** * Renders the form select list * * @param array $forms Form listing */ public function default_form_callback($forms) { $html = sprintf(''; if (empty($forms)) { $html .= 'Enter your API Key above to get your available forms.
'; } echo $html; } /** * Sanitizes the settings * * @param array $settings The settings fields submitted * @return array Sanitized settings */ public function sanitize_settings($settings) { return shortcode_atts(array( 'api_key' => '', 'api_secret' => '', 'default_form' => 0 ), $settings); } }