* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Caper_Custom_Control extends WP_Customize_Control { protected function get_caper_resource_url() { if( strpos( wp_normalize_path( __DIR__ ), wp_normalize_path( WP_PLUGIN_DIR ) ) === 0 ) { // We're in a plugin directory and need to determine the url accordingly. return plugin_dir_url( __DIR__ ); } return trailingslashit( get_template_directory_uri() ); } } /** * Custom Section Base Class * * @author Anthony Hortin * @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Caper_Custom_Section extends WP_Customize_Section { protected function get_caper_resource_url() { if( strpos( wp_normalize_path( __DIR__ ), wp_normalize_path( WP_PLUGIN_DIR ) ) === 0 ) { // We're in a plugin directory and need to determine the url accordingly. return plugin_dir_url( __DIR__ ); } return trailingslashit( get_template_directory_uri() ); } } /** * Image Checkbox Custom Control * * @author Anthony Hortin * @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Caper_Image_Checkbox_Custom_Control extends caper_Custom_Control { /** * The type of control being rendered */ public $type = 'image_checkbox'; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_style( 'caper-custom-controls-css', $this->get_caper_resource_url() . 'inc/customizer/css/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { ?>
label ) ) { ?> label ); ?> description ) ) { ?> description ); ?> value() ) ); ?> link(); ?> /> choices as $key => $value ) { ?>
* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Caper_Text_Radio_Button_Custom_Control extends caper_Custom_Control { /** * The type of control being rendered */ public $type = 'text_radio_button'; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_style( 'caper-custom-controls-css', $this->get_caper_resource_url() . 'inc/customizer/css/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { ?>
label ) ) { ?> label ); ?> description ) ) { ?> description ); ?>
choices as $key => $value ) { ?>
* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Caper_Image_Radio_Button_Custom_Control extends caper_Custom_Control { /** * The type of control being rendered */ public $type = 'image_radio_button'; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_style( 'caper-custom-controls-css', $this->get_caper_resource_url() . 'inc/customizer/css/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { ?>
label ) ) { ?> label ); ?> description ) ) { ?> description ); ?> choices as $key => $value ) { ?>
* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Caper_Toggle_Switch_Custom_control extends caper_Custom_Control { /** * The type of control being rendered */ public $type = 'toggle_switch'; /** * Enqueue our scripts and styles */ public function enqueue(){ wp_enqueue_style( 'caper-custom-controls-css', $this->get_caper_resource_url() . 'inc/customizer/css/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content(){ ?>
label ); ?> description ) ) { ?> description ); ?>
link(); checked( $this->value() ); ?>>