public function create_admin_page() { // Set class property $this->options = get_option('cptbc_settings'); if (!$this->options) { cptbc_set_options(); $this->options = get_option('cptbc_settings'); } ?> <div class="wrap"> <h2>CPT Bootstrap Carousel <?php _e('Settings', 'cpt-bootstrap-carousel'); ?> </h2> <p><?php printf(__('You can set the default behaviour of your carousels here. Most of these settings can be overridden by using %s shortcode attributes %s.', 'cpt-bootstrap-carousel'), '<a href="http://wordpress.org/plugins/cpt-bootstrap-carousel/" target="_blank">', '</a>'); ?> </p> <form method="post" action="options.php"> <?php settings_fields('cptbc_settings'); do_settings_sections('cpt-bootstrap-carousel'); submit_button(); ?> </form> </div> <?php }
function cptbc_shortcode($atts, $content = null) { // Set default shortcode attributes $options = get_option('cptbc_settings'); if (!$options) { cptbc_set_options(); $options = get_option('cptbc_settings'); } $options['id'] = ''; // Parse incomming $atts into an array and merge it with $defaults $atts = shortcode_atts($options, $atts); return cptbc_frontend($atts); }