options = affcoups_get_options(); // Initialize add_action('admin_menu', array( &$this, 'add_admin_menu') ); add_action('admin_init', array( &$this, 'init_settings') ); } function add_admin_menu() { /* * Source: https://codex.wordpress.org/Function_Reference/add_options_page */ add_submenu_page( 'edit.php?post_type=affcoups_coupon', __( 'Affiliate Coupons - Settings', 'affiliate-coupons' ), // Page title __( 'Settings', 'affiliate-coupons' ), // Menu title 'manage_options', // Capabilities 'affcoups_settings', // Menu slug array( &$this, 'options_page' ) // Callback ); } function init_settings() { register_setting( 'affcoups_settings', 'affcoups_settings', array( &$this, 'validate_input_callback' ) ); /* * Section: Quickstart */ add_settings_section( 'affcoups_settings_section_quickstart', __('Quickstart Guide', 'affiliate-coupons'), array( &$this, 'section_quickstart_render' ), 'affcoups_settings' ); /* * Section: General */ add_settings_section( 'affcoups_settings_section_general', __('General', 'affiliate-coupons'), false, 'affcoups_settings' ); add_settings_field( 'affcoups_settings_coupon_expiration', __('Expiration', 'affiliate-coupons'), array(&$this, 'coupon_expiration_render'), 'affcoups_settings', 'affcoups_settings_section_general', array('label_for' => 'affcoups_hide_expired_coupons') ); add_settings_field( 'affcoups_settings_order', __('Sorting', 'affiliate-coupons'), array(&$this, 'order_render'), 'affcoups_settings', 'affcoups_settings_section_general', array('label_for' => 'affcoups_order') ); /* * Section: Output */ add_settings_section( 'affcoups_settings_section_output', __('Output', 'affiliate-coupons'), false, 'affcoups_settings' ); add_settings_field( 'affcoups_settings_templates', __('Templates', 'affiliate-coupons'), array(&$this, 'templates_render'), 'affcoups_settings', 'affcoups_settings_section_output', array('label_for' => 'affcoups_template') ); add_settings_field( 'affcoups_settings_contents', __('Contents', 'affiliate-coupons'), array(&$this, 'contents_render'), 'affcoups_settings', 'affcoups_settings_section_output', false ); add_settings_field( 'affcoups_settings_discount', __('Discount', 'affiliate-coupons'), array(&$this, 'discount_render'), 'affcoups_settings', 'affcoups_settings_section_output', false ); add_settings_field( 'affcoups_settings_button', __('Button', 'affiliate-coupons'), array(&$this, 'button_render'), 'affcoups_settings', 'affcoups_settings_section_output', array('label_for' => 'affcoups_button_text') ); add_settings_field( 'affcoups_settings_custom_css', __('Custom CSS', 'affiliate-coupons'), array(&$this, 'custom_css_render'), 'affcoups_settings', 'affcoups_settings_section_output', array('label_for' => 'affcoups_custom_css') ); } function validate_input_callback( $input ) { /* * Here you can validate (and manipulate) the user input before saving to the database */ return $input; } function section_quickstart_render() { ?>
[affcoups]
[affcoups id="123"] [affcoups id="123,456,789"]
[affcoups vendor="123"]
[affcoups category="123"] [affcoups category="group-xyz"]
[affcoups type="123"] [affcoups type="type-xyz"]
[affcoups hide_expired="true"] [affcoups hide_expired="false"]
[affcoups order="asc"] (asc, desc)
[affcoups orderby="title"] (name, date, random, title, description, discount, valid_from, valid_to)
[affcoups template="standard"]
standard, grid, list & widget
[affcoups grid="2"], [affcoups grid="3"] etc.
Section two description...
__( 'Standard', 'affiliate-coupons' ), 'grid' => __('Grid', 'affiliate-coupons') ); $template = ( isset ( $this->options['template'] ) ) ? $this->options['template'] : 'grid'; $grid_size = ( ! empty( $this->options['grid_size'] ) && is_numeric( $this->options['grid_size'] ) ) ? intval( $this->options['grid_size'] ) : 3; ?>
options['excerpt_length'] ) && is_numeric( $this->options['excerpt_length'] ) ) ? intval( $this->options['excerpt_length'] ) : 90; ?>
options['discount_bg_color'] ) ) ? $this->options['discount_bg_color'] : ''; $discount_color = ( isset ( $this->options['discount_color'] ) ) ? $this->options['discount_color'] : ''; ?>
the_color_picker_note(); ?> options['button_text'] ) ) ? esc_attr( trim( $this->options['button_text'] ) ) : __( 'Go to the deal', 'affiliate-coupons' ); $button_icon_options = array( '' => __( 'None', 'affiliate-coupons' ), 'hand-right' => __('Hand right', 'affiliate-coupons'), 'gavel' => __('Gavel', 'affiliate-coupons'), 'cart' => __('Shopping cart', 'affiliate-coupons') ); $button_icon = ( isset ( $this->options['button_icon'] ) ) ? $this->options['button_icon'] : ''; $button_bg_color = ( isset ( $this->options['button_bg_color'] ) ) ? $this->options['button_bg_color'] : ''; $button_color = ( isset ( $this->options['button_color'] ) ) ? $this->options['button_color'] : ''; ?>
the_color_picker_note(); ?> options['custom_css_activated'] ) && $this->options['custom_css_activated'] == '1' ) ? 1 : 0; $custom_css = ( !empty ( $this->options['custom_css'] ) ) ? $this->options['custom_css'] : ''; ?>
>
style tag. Simply paste you CSS classes/definitions e.g. .affcoups .affcoups-coupon { background-color: #333; }", 'affiliate-coupons' ) ?>