├── docs ├── readme.md └── _config.yml ├── .github └── FUNDING.yml ├── twentyseventeen-child ├── style.css ├── functions.php └── wpts │ ├── wp_theme_settings.min.js │ ├── wp_theme_settings.js │ ├── wp_theme_settings.css │ └── wp_theme_settings.php ├── changelog.md ├── README.md ├── wp_theme_settings.min.js ├── wp_theme_settings.js ├── wp_theme_settings.css └── wp_theme_settings.php /docs/readme.md: -------------------------------------------------------------------------------- 1 | docs 2 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ['https://www.paypal.me/MattiasG', 'https://en.cryptobadges.io/donate/0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5'] 4 | -------------------------------------------------------------------------------- /twentyseventeen-child/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Theme Name: Twenty Seventeen Child 3 | Theme URI: http://example.com/twenty-seventeen-child/ 4 | Description: Twenty Seventeen Child Theme 5 | Author: John Doe 6 | Author URI: http://example.com 7 | Template: twentyseventeen 8 | Version: 1.0.0 9 | License: GNU General Public License v2 or later 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 | Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready 12 | Text Domain: twenty-seventeen-child 13 | */ -------------------------------------------------------------------------------- /twentyseventeen-child/functions.php: -------------------------------------------------------------------------------- 1 | 'text', 30 | 'label' => 'Example Input', 31 | 'name' => 'example_input' , 32 | 'description' => 'Example description', 33 | ], 34 | [ 35 | 'type' => 'fa', 36 | 'label' => 'Example Icons', 37 | 'name' => 'example_icons' , 38 | 'description' => 'Example description', 39 | ], 40 | ]; 41 | 42 | $wpts = new wp_theme_settings( 43 | array( 44 | 'general' => array('description' => 'A custom WordPress class for creating theme settings page'), 45 | 'settingsID' => 'wp_theme_settings', 46 | 'settingFields' => array('wp_theme_settings_title'), 47 | 'tabs' => array( 48 | 'general' => array('text' => 'General', 'dashicon' => 'dashicons-admin-generic' , 'tabFields' => $wpts_general_fields), 49 | 'buttons' => array('text' => 'Buttons') 50 | ), 51 | ) 52 | ); 53 | ?> -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | **2.4.5** 2 | + Fix for foreach() on line 339. 3 | 4 | **2.4.4** 5 | + New action hooks for tabs. 6 | + Tabs can now have Sections (SubTabs). 7 | + Minor changes to CSS & JS. 8 | + Min js included. 9 | 10 | **2.4.0** 11 | + Notification when a new update is available. 12 | + Minor CSS changes. 13 | + Tooltip for tabFields (Works only on input,toggle,select). 14 | 15 | **2.3.9** 16 | + tab_container error fix. 17 | + CSS on h1 title. 18 | 19 | **2.3.8** 20 | + WP Toolbar. 21 | 22 | **2.3.7** 23 | + wpts-file-field (media-upload | Choose image/upload image) for tabFields. 24 | + FontAwesome 4.7.0 25 | + js wpts version removed. 26 | 27 | **2.3.6** 28 | + Error row 118 fix. 29 | 30 | **2.3.5** 31 | + Option to use WPTS for plugins. 32 | + Js changes. 33 | 34 | **2.3.4** 35 | + Get option(s) with apply_filters('wpts_option', 'key-here') instead of esc_attr(get_option('key-here')) both work. 36 | + ABSPATH added. 37 | + Options replaced with wpts_option in binput(). 38 | 39 | **2.3.3** 40 | + FontAwesomeArray removed. 41 | + Fix line 166/173. 42 | + New FontAwesome Selector (add class name wpts_fa_field to a input) + option for tabFields. 43 | 44 | **2.3.2** 45 | + Toggle Switch for tabFields. 46 | 47 | **2.3.1** 48 | + color field class renamed from wp_theme_settings_color_field to wpts_color_field. 49 | + tabFields (Auto build fields). 50 | + Action hook added for table wpts_tab_NameHere_table 51 | 52 | **2.1.3** 53 | + scrollTop after tab clicked. 54 | 55 | **2.1.2** 56 | + wpColorPicker added (Add wp_theme_settings_color_field class to input text). 57 | + FontAwesomeArray 4.6.3 added. 58 | + FontAwesome 4.6.3 CSS (Back End). 59 | 60 | **2.1.0** 61 | + Style for input,select. 62 | + Return to selected tab after save. 63 | 64 | **2.0** 65 | + Class was completly re-written & more options added. 66 | 67 | **1.1** 68 | + checkTabs() function replaced with keyEntity(). 69 | + WP Dashicons added for tabs. 70 | + Reworked tab array. 71 | 72 | **1.0** 73 | + Release. 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wp_theme_settings (Discontinued) 2 | ## Checkout [Iroh The WordPress Starter Theme For Developers](https://github.com/mattiasghodsian/Iroh) 3 | 4 | **A custom WordPress class for creating theme settings page (Compatible Wordpress 4.5+, Tested on Wordpress 4.7.3)** 5 | 6 |  7 | 8 | 9 | NOTE 10 | ---- 11 | This is a utility class intended to create a theme settings page. Read full [docs](https://github.com/mattiasghodsian/wp_theme_settings/wiki) and [changelog](https://github.com/mattiasghodsian/wp_theme_settings/blob/master/changelog.md) 12 | 13 | Installation 14 | ------------ 15 | Place **wp_theme_settings.php**, **wp_theme_settings.js** and **wp_theme_settings.css** in your WordPress theme folder `/wp-content/your-theme/` 16 | 17 | Open your WordPress themes **functions.php** file `/wp-content/your-theme/functions.php` add the following code: 18 | 19 | ```php 20 | include 'wp_theme_settings.php'; 21 | ``` 22 | 23 | Add both CSS & JS file to Wordpress with **admin_enqueue_scripts** 24 | 25 | ```php 26 | add_action('admin_enqueue_scripts', 'wp_theme_settings_add_stylesheet'); 27 | function wp_theme_settings_add_stylesheet(){ 28 | wp_enqueue_style('wp_theme_settings', get_template_directory_uri().'/wp_theme_settings.css'); 29 | wp_register_script('wp_theme_settings',get_template_directory_uri() . '/wp_theme_settings.js', array( 'wp-color-picker' )); 30 | wp_enqueue_script('wp_theme_settings'); 31 | } 32 | ``` 33 | 34 | 35 | 36 | Example 37 | ------------ 38 | ```php 39 | include 'wp_theme_settings.php'; 40 | 41 | $wpts = new wp_theme_settings( 42 | array( 43 | 'general' => array('description' => 'A custom WordPress class for creating theme settings page'), 44 | 'settingsID' => 'wp_theme_settings', 45 | 'settingFields' => array('wp_theme_settings_title'), 46 | 'tabs' => array( 47 | 'general' => array('text' => 'General', 'dashicon' => 'dashicons-admin-generic' ), 48 | 'buttons' => array('text' => 'Buttons') 49 | ), 50 | ) 51 | ); 52 | 53 | add_action('wpts_tab_general' , 'general'); 54 | function general(){ 55 | ?> 56 |
57 | 58 | a").removeClass("nav-tab-active"),jQuery(this).addClass("nav-tab-active"),location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var a=jQuery(this.hash);a.length&&(jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(a).css("display","block"),jQuery(a.selector+" > .wpts-nav-section-holder").css("display","none"),jQuery(a.selector+"_parent").css("display","block"),jQuery(".nav-rtab-form").attr("action","options.php"+a.selector),jQuery("html, body").animate({scrollTop:0},1))}}),jQuery(".wpts-nav-sections > li > a").click(function(){var a=jQuery(this).attr("href");if(a.indexOf("&")!=-1){var b=a.split("&"),c=b[0],d=b[1].replace("section=","#");jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(c).css("display","block"),jQuery(c+" > .wpts-nav-section-holder").css("display","none"),jQuery(d).css("display","block"),jQuery(".nav-rtab-form").attr("action","options.php"+a),jQuery("html, body").animate({scrollTop:0},1)}}),window.location.hash.length){var a=window.location.hash;if(a.indexOf("&")!=-1){var b=a.split("&"),c=b[0],d=b[1].replace("section=","#");jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(c).css("display","block"),jQuery(d).css("display","block")}else jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(a).css("display","block"),jQuery(a+"_parent").css("display","block"),jQuery(".nav-rtab-wrapper > a").removeClass("nav-tab-active"),jQuery('.nav-rtab-wrapper a[href="'+a+'"]').each(function(b){jQuery(this).addClass("nav-tab-active"),jQuery(".nav-rtab-form").attr("action","options.php"+a)})}else{var a=jQuery(".nav-rtab-wrapper > a").first().attr("href");jQuery(a).css("display","block"),jQuery(a+"_parent").css("display","block")}jQuery(".nav-tab-wrapper").length>0&&jQuery("#footer-thankyou").html('Thank you for creating with WPTS'),jQuery(".wpts_color_field").wpColorPicker(),jQuery(".wpts_fa_field").wptsFa();var e;jQuery(".wpts-file-field").click(function(){return jQuery("html").addClass("Image"),e=jQuery(this).prev().attr("id"),tb_show("Upload File","media-upload.php?type=image&TB_iframe=true"),!1}),window.original_send_to_editor=window.send_to_editor,window.send_to_editor=function(a){e?(re=/\ssrc=(?:(?:'([^']*)')|(?:"([^"]*)")|([^\s]*))/i,res=a.match(re),src=res[1]||res[2]||res[3],jQuery("#"+e).val(src),jQuery(".wpts-file-field-preview").before("#"+e).attr("src",src),tb_remove(),jQuery("html").removeClass("Image")):window.original_send_to_editor(a)}}),function(a){a.fn.wptsFa=function(){return this.each(function(){var b=a(this),c=a(b).attr("name");a(b).hide(),a('| '; 198 | if (array_key_exists('label', $data)) { 199 | echo ''; 200 | } 201 | echo ' | '; 202 | 203 | echo '';
204 | echo $this->binput($data);
205 | if (array_key_exists('description', $data)) {
206 | echo ' '.$data['description'].' '; 207 | } 208 | echo ' | ';
209 |
210 | echo '
|---|
%2$s
| '; 198 | if (array_key_exists('label', $data)) { 199 | echo ''; 200 | } 201 | echo ' | '; 202 | 203 | echo '';
204 | echo $this->binput($data);
205 | if (array_key_exists('description', $data)) {
206 | echo ' '.$data['description'].' '; 207 | } 208 | echo ' | ';
209 |
210 | echo '
|---|
%2$s