Arashtad.com Version: 1.1 Author: Amin Shahrokhi Author URI: https://arashtad.com/ License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html Copyright: (c) 2011 - 2016 Arashtad Ltd. All Rights Reserved. Arashtad Toggle is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version. Arashtad Toggle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Arashtad Toggle. If not, see https://www.gnu.org/licenses/gpl-2.0.html. */ // Restricting direct access defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); // Creating the widget class wpitoggle_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of your widget 'wpitoggle_widget', // Widget name will appear in UI __('Arashtad Toggle', 'wpitoggle_widget_domain'), // Widget description array( 'description' => __( 'Responsive toggle widget for WordPress, created by Arashtad Ltd. See Arashtad.com for more details and professional products and services.', 'wpitoggle_widget_domain' ), ) ); } // Creating widget front-end // This is where the action happens public function widget( $args, $instance ) { //$widget_id = $widget_class[ count($widget_class) - 1]; $widget_id = $args['widget_id']; $widget_exploded = explode('-', $widget_id); $widget_id_num = array_slice($widget_exploded, -1); $widget_num = implode($widget_id_num); $title = apply_filters( 'widget_title', $instance['title'] ); $style = apply_filters( 'widget_text', $instance['style'] ); $header_text = apply_filters( 'widget_text', $instance['header_text'] ); $footer_text = apply_filters( 'widget_text', $instance['footer_text'] ); $fixed_width = apply_filters( 'widget_text', $instance['fixed_width'] ); $fixed_height = apply_filters( 'widget_text', $instance['fixed_height'] ); $margin = apply_filters( 'widget_text', $instance['margin'] ); $padding = apply_filters( 'widget_text', $instance['padding'] ); $heading1 = apply_filters( 'widget_text', $instance['heading1'] ); $content1 = apply_filters( 'widget_text', $instance['content1'] ); $heading2 = apply_filters( 'widget_text', $instance['heading2'] ); $content2 = apply_filters( 'widget_text', $instance['content2'] ); $heading3 = apply_filters( 'widget_text', $instance['heading3'] ); $content3 = apply_filters( 'widget_text', $instance['content3'] ); $heading4 = apply_filters( 'widget_text', $instance['heading4'] ); $content4 = apply_filters( 'widget_text', $instance['content4'] ); $heading5 = apply_filters( 'widget_text', $instance['heading5'] ); $content5 = apply_filters( 'widget_text', $instance['content5'] ); $heading6 = apply_filters( 'widget_text', $instance['heading6'] ); $content6 = apply_filters( 'widget_text', $instance['content6'] ); $heading7 = apply_filters( 'widget_text', $instance['heading7'] ); $content7 = apply_filters( 'widget_text', $instance['content7'] ); $heading8 = apply_filters( 'widget_text', $instance['heading8'] ); $content8 = apply_filters( 'widget_text', $instance['content8'] ); $heading9 = apply_filters( 'widget_text', $instance['heading9'] ); $content9 = apply_filters( 'widget_text', $instance['content9'] ); $heading10 = apply_filters( 'widget_text', $instance['heading10'] ); $content10 = apply_filters( 'widget_text', $instance['content10'] ); $heading11 = apply_filters( 'widget_text', $instance['heading11'] ); $content11 = apply_filters( 'widget_text', $instance['content11'] ); $heading12 = apply_filters( 'widget_text', $instance['heading12'] ); $content12 = apply_filters( 'widget_text', $instance['content12'] ); $heading13 = apply_filters( 'widget_text', $instance['heading13'] ); $content13 = apply_filters( 'widget_text', $instance['content13'] ); $heading14 = apply_filters( 'widget_text', $instance['heading14'] ); $content14 = apply_filters( 'widget_text', $instance['content14'] ); $heading15 = apply_filters( 'widget_text', $instance['heading15'] ); $content15 = apply_filters( 'widget_text', $instance['content15'] ); $heading16 = apply_filters( 'widget_text', $instance['heading16'] ); $content16 = apply_filters( 'widget_text', $instance['content16'] ); $heading17 = apply_filters( 'widget_text', $instance['heading17'] ); $content17 = apply_filters( 'widget_text', $instance['content17'] ); $heading18 = apply_filters( 'widget_text', $instance['heading18'] ); $content18 = apply_filters( 'widget_text', $instance['content18'] ); $heading19 = apply_filters( 'widget_text', $instance['heading19'] ); $content19 = apply_filters( 'widget_text', $instance['content19'] ); $heading20 = apply_filters( 'widget_text', $instance['heading20'] ); $content20 = apply_filters( 'widget_text', $instance['content20'] ); // before and after widget arguments are defined by themes echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; // This is where you run the code and display the output echo __( '', 'wpitoggle_widget_domain' ); ?> '; echo ' #itoggle' . $widget_num . ' {'; if($fixed_height) { echo 'height: ' . $fixed_height . '; '; } if($fixed_width) { echo 'width: ' . $fixed_width . '; '; } if($margin) { echo 'margin: ' . $margin . '; '; } if($padding) { echo 'padding: ' . $padding . '; '; } echo '}'; echo ' '; } ?>