Changeset 2683948
- Timestamp:
- 02/23/2022 06:51:32 PM (4 years ago)
- Location:
- simple-theme-options
- Files:
-
- 18 added
- 6 edited
-
tags/1.6 (added)
-
tags/1.6/chrs-simple-options.php (added)
-
tags/1.6/css (added)
-
tags/1.6/css/styles.css (added)
-
tags/1.6/index.php (added)
-
tags/1.6/input-global.php (added)
-
tags/1.6/instructions.php (added)
-
tags/1.6/readme.txt (added)
-
tags/1.6/screenshot-1.png (added)
-
tags/1.6/shortcodes.php (added)
-
tags/1.7/chrs-simple-options.php (added)
-
tags/1.7/css (added)
-
tags/1.7/css/styles.css (added)
-
tags/1.7/index.php (added)
-
tags/1.7/input-global.php (modified) (1 diff)
-
tags/1.7/instructions.php (added)
-
tags/1.7/readme.txt (added)
-
tags/1.7/screenshot-1.png (added)
-
tags/1.7/shortcodes.php (added)
-
trunk/chrs-simple-options.php (modified) (2 diffs)
-
trunk/input-global.php (modified) (1 diff)
-
trunk/instructions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/shortcodes.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simple-theme-options/tags/1.7/input-global.php
r2683225 r2683948 1 1 <div class="wrap"> 2 2 <h2>Simple Theme Options</h2> 3 <div id=" wpcom-stats-meta-box-container" class="metabox-holder">3 <div id="theme-options-form-container" class="metabox-holder"> 4 4 <form method="post" action="options.php"> 5 <?php settings_fields( 'chrs_options' ); ?> 6 <?php $options = get_option( 'chrs_theme_options' ); ?> 7 <div class="postbox-container" style="width: 55%;margin-right: 10px;"> 8 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 9 <div class="postbox" id="chrs-global-settings"> 10 <h3 class="hndle"><span>Global Settings</span></h3> 11 <div class="inside"> 12 <table cellpadding="0" class="chrs-input-global-fields"> 13 <tbody> 14 <tr> 15 <th width="30%" align="left" valign="top" scope="row"><?php _e( 'Google Analytics', 'chrssto' ); ?></th> 16 <td width="5%"></td> 17 <td align="left"> 18 <?php if(current_user_can('unfiltered_html')){?> 19 <textarea id="chrs_theme_options[analytics]" class="large-text" cols="50" rows="10" name="chrs_theme_options[analytics]"><?php echo esc_textarea( $options['analytics'] ); ?></textarea><br /> 20 <label for="chrs_theme_options[analytics]"><?php _e( 'Add your Google Analytics code here.', 'chrssto' ); ?></label> 21 <?php }else{?> 22 <h2 class="warning"><?php _e( 'You need to have unfiltered_html capability to use this setting', 'chrssto' ); ?></h2> 23 <?php }?> 24 25 </td> 26 </tr> 27 <tr> 28 <th align="left" valign="top" scope="row"><?php _e( 'Other Code<br />add to header.php', 'chrssto' ); ?></th> 29 <td></td> 30 <td align="left"> 31 <?php if(current_user_can('unfiltered_html')){?> 32 <textarea id="chrs_theme_options[customCodeHeader]" class="large-text" cols="50" rows="10" name="chrs_theme_options[customCodeHeader]"><?php echo esc_textarea( $options['customCodeHeader'] ); ?></textarea> 33 <label for="chrs_theme_options[customCodeHeader]"> 34 <?php _e( 'Any custom code that needs to be added to header.php', 'chrssto' ); ?> 35 </label> 36 <?php }?> 37 </td> 38 </tr> 39 <tr> 40 <th align="left" valign="top" scope="row"><?php _e( 'Other Code<br />add to footer.php', 'chrssto' ); ?></th> 41 <td></td> 42 <td align="left"> 43 <?php if(current_user_can('unfiltered_html')){?> 44 <textarea id="chrs_theme_options[customCodeFooter]" class="large-text" cols="50" rows="10" name="chrs_theme_options[customCodeFooter]"><?php echo esc_textarea( $options['customCodeFooter'] ); ?></textarea> 45 <label for="chrs_theme_options[customCodeFooter]"> 46 <?php _e( 'Any custom code that needs to be added to footer.php', 'chrssto' ); ?> 47 </label> 48 <?php }?> 49 </td> 50 </tr> 51 </tbody> 52 </table> 53 54 </div> 55 <div id="major-publishing-actions"> 56 <div id="publishing-action"> 57 <?php if(current_user_can('unfiltered_html')){?> 58 <input type="submit" name="save" id="save" class="button button-primary" value="<?php _e( 'Save Options', 'chrssto' ); ?>" /> 59 <?php }?> 60 </div> 61 <div class="clear"></div> 62 </div> 63 </div> 64 </div> 65 </div> 66 <div class="postbox-container" style="width: 44%;"> 67 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 68 <div class="postbox" id="chrs-social-settings"> 69 <h3 class="hndle"><span>Social Media</span></h3> 70 <div class="inside"> 71 <table cellpadding="0" class="chrs-input-social-fields"> 72 <tr> 73 <th width="40%" align="left" valign="top" scope="row"><?php _e( 'Facebook URL', 'chrssto' ); ?></th> 74 <td width="5%"></td> 75 <td align="left"><input id="chrs_theme_options[fburl]" type="text" name="chrs_theme_options[fburl]" value="<?php esc_attr_e( $options['fburl'] ); ?>" /><br /> 76 <label for="chrs_theme_options[fburl]"> 77 <?php _e( 'http://facebook.com/yourprofileurl', 'chrssto' ); ?> 78 </label></td> 79 </tr> 80 <tr> 81 <th align="left" valign="top" scope="row"><?php _e( 'Twitter URL', 'chrssto' ); ?></th> 82 <td></td> 83 <td align="left"><input id="chrs_theme_options[twurl]" type="text" name="chrs_theme_options[twurl]" value="<?php esc_attr_e( $options['twurl'] ); ?>" /><br /> 84 <label for="chrs_theme_options[twurl]"> 85 <?php _e( 'http://twitter.com/yourprofileurl', 'chrssto' ); ?> 86 </label></td> 87 </tr> 88 <tr> 89 <th align="left" valign="top" scope="row"><?php _e( 'Instagram URL', 'chrssto' ); ?></th> 90 <td></td> 91 <td align="left"><input id="chrs_theme_options[igurl]" type="text" name="chrs_theme_options[igurl]" value="<?php esc_attr_e( $options['igurl'] ); ?>" /><br /> 92 <label for="chrs_theme_options[igurl]"> 93 <?php _e( 'http://instagram.com/yourprofileurl', 'chrssto' ); ?> 94 </label></td> 95 </tr> 96 <tr> 97 <th align="left" valign="top" scope="row"><?php _e( 'WhatsApp URL', 'chrssto' ); ?></th> 98 <td></td> 99 <td align="left"><input id="chrs_theme_options[waurl]" type="text" name="chrs_theme_options[waurl]" value="<?php esc_attr_e( $options['waurl'] ); ?>" /><br /> 100 <label for="chrs_theme_options[waurl]"> 101 <?php _e( 'https://wa.me/1234567890', 'chrssto' ); ?> 102 </label></td> 103 </tr> 104 <tr> 105 <th align="left" valign="top" scope="row"><?php _e( 'Google+ URL', 'chrssto' ); ?></th> 106 <td></td> 107 <td align="left"><input id="chrs_theme_options[gpurl]" type="text" name="chrs_theme_options[gpurl]" value="<?php esc_attr_e( $options['gpurl'] ); ?>" /><br /> 108 <label for="chrs_theme_options[gpurl]"> 109 <?php _e( 'https://plus.google.com/xxxxxxxxx/posts', 'chrssto' ); ?> 110 </label></td> 111 </tr> 112 <tr> 113 <th align="left" valign="top" scope="row"><?php _e( 'Pinterest URL', 'chrssto' ); ?></th> 114 <td></td> 115 <td align="left"><input id="chrs_theme_options[pturl]" type="text" name="chrs_theme_options[pturl]" value="<?php esc_attr_e( $options['pturl'] ); ?>" /><br /> 116 <label for="chrs_theme_options[pturl]"> 117 <?php _e( 'http://www.pinterest.com/yourprofileurl', 'chrssto' ); ?> 118 </label></td> 119 </tr> 120 <tr> 121 <th align="left" valign="top" scope="row"><?php _e( 'Youtube URL', 'chrssto' ); ?></th> 122 <td></td> 123 <td align="left"><input id="chrs_theme_options[yturl]" type="text" name="chrs_theme_options[yturl]" value="<?php esc_attr_e( $options['yturl'] ); ?>" /><br /> 124 <label for="chrs_theme_options[yturl]"> 125 <?php _e( 'http://www.youtube.com/user/yourprofileurl', 'chrssto' ); ?> 126 </label></td> 127 </tr> 128 <tr> 129 <th align="left" valign="top" scope="row"><?php _e( 'TikTok URL', 'chrssto' ); ?></th> 130 <td></td> 131 <td align="left"><input id="chrs_theme_options[tturl]" type="text" name="chrs_theme_options[tturl]" value="<?php esc_attr_e( $options['tturl'] ); ?>" /><br /> 132 <label for="chrs_theme_options[tturl]"> 133 <?php _e( 'https://www.tiktok.com/@yourprofileurl', 'chrssto' ); ?> 134 </label></td> 135 </tr> 136 <tr> 137 <th align="left" valign="top" scope="row"><?php _e( 'Yelp URL', 'chrssto' ); ?></th> 138 <td></td> 139 <td align="left"><input id="chrs_theme_options[ypurl]" type="text" name="chrs_theme_options[ypurl]" value="<?php esc_attr_e( $options['ypurl'] ); ?>" /><br /> 140 <label for="chrs_theme_options[ypurl]"> 141 <?php _e( 'http://www.yelp.com/biz/yourprofileurl', 'chrssto' ); ?> 142 </label></td> 143 </tr> 144 <tr> 145 <th align="left" valign="top" scope="row"><?php _e( 'Snapchat URL', 'chrssto' ); ?></th> 146 <td></td> 147 <td align="left"><input id="chrs_theme_options[scurl]" type="text" name="chrs_theme_options[scurl]" value="<?php esc_attr_e( $options['scurl'] ); ?>" /><br /> 148 <label for="chrs_theme_options[scurl]"> 149 <?php _e( 'https://snapchat.com/add/username', 'chrssto' ); ?> 150 </label></td> 151 </tr> 152 <tr> 153 <th align="left" valign="top" scope="row"><?php _e( 'Discord URL', 'chrssto' ); ?></th> 154 <td></td> 155 <td align="left"><input id="chrs_theme_options[diurl]" type="text" name="chrs_theme_options[diurl]" value="<?php esc_attr_e( $options['diurl'] ); ?>" /><br /> 156 <label for="chrs_theme_options[diurl]"> 157 <?php _e( 'https://discord.gg/123ABC', 'chrssto' ); ?> 158 </label></td> 159 </tr> 160 <tr> 161 <th align="left" valign="top" scope="row"><?php _e( 'WordPress.com URL', 'chrssto' ); ?></th> 162 <td></td> 163 <td align="left"><input id="chrs_theme_options[wpurl]" type="text" name="chrs_theme_options[wpurl]" value="<?php esc_attr_e( $options['wpurl'] ); ?>" /><br /> 164 <label for="chrs_theme_options[wpurl]"> 165 <?php _e( 'http://yourprofile.wordpress.com', 'chrssto' ); ?> 166 </label></td> 167 </tr> 168 <tr> 169 <th align="left" valign="top" scope="row"><?php _e( 'Linkedin URL', 'chrssto' ); ?></th> 170 <td></td> 171 <td align="left"><input id="chrs_theme_options[liurl]" type="text" name="chrs_theme_options[liurl]" value="<?php esc_attr_e( $options['liurl'] ); ?>" /><br /> 172 <label for="chrs_theme_options[liurl]"> 173 <?php _e( 'https://www.linkedin.com/in/yourprofile', 'chrssto' ); ?> 174 </label></td> 175 </tr> 176 <tr> 177 <th align="left" valign="top" scope="row"><?php _e( 'Tumblr URL', 'chrssto' ); ?></th> 178 <td></td> 179 <td align="left"><input id="chrs_theme_options[tburl]" type="text" name="chrs_theme_options[tburl]" value="<?php esc_attr_e( $options['tburl'] ); ?>" /><br /> 180 <label for="chrs_theme_options[tburl]"> 181 <?php _e( 'https://yourprofile.tumblr.com', 'chrssto' ); ?> 182 </label></td> 183 </tr> 184 <tr> 185 <th align="left" valign="top" scope="row"><?php _e( 'Flickr URL', 'chrssto' ); ?></th> 186 <td></td> 187 <td align="left"><input id="chrs_theme_options[fkurl]" type="text" name="chrs_theme_options[fkurl]" value="<?php esc_attr_e( $options['fkurl'] ); ?>" /><br /> 188 <label for="chrs_theme_options[fkurl]"> 189 <?php _e( 'https://www.flickr.com/photos/yourprofile/', 'chrssto' ); ?> 190 </label></td> 191 </tr> 192 <tr> 193 <th align="left" valign="top" scope="row"><?php _e( 'MySpace URL', 'chrssto' ); ?></th> 194 <td></td> 195 <td align="left"><input id="chrs_theme_options[msurl]" type="text" name="chrs_theme_options[msurl]" value="<?php esc_attr_e( $options['msurl'] ); ?>" /><br /> 196 <label for="chrs_theme_options[msurl]"> 197 <?php _e( 'https://myspace.com/yourprofile', 'chrssto' ); ?> 198 </label></td> 199 </tr> 200 <tr> 201 <th align="left" valign="top" scope="row"><?php _e( 'Custom 1', 'chrssto' ); ?></th> 202 <td></td> 203 <td align="left"><input id="chrs_theme_options[ct1url]" type="text" name="chrs_theme_options[ct1url]" value="<?php esc_attr_e( $options['ct1url'] ); ?>" /><br /> 204 <label for="chrs_theme_options[ct1url]"> 205 <?php _e( 'http://anyurl.com', 'chrssto' ); ?> 206 </label></td> 207 </tr> 208 <tr> 209 <th align="left" valign="top" scope="row"><?php _e( 'Custom 2', 'chrssto' ); ?></th> 210 <td></td> 211 <td align="left"><input id="chrs_theme_options[ct2url]" type="text" name="chrs_theme_options[ct2url]" value="<?php esc_attr_e( $options['ct2url'] ); ?>" /><br /> 212 <label for="chrs_theme_options[ct2url]"> 213 <?php _e( 'http://anyurl.com', 'chrssto' ); ?> 214 </label></td> 215 </tr> 216 </table> 217 </div> 218 <div id="major-publishing-actions"> 219 <div id="publishing-action"> 220 <input type="submit" name="save" id="save" class="button button-primary" value="<?php _e( 'Save Options', 'chrssto' ); ?>" /> 221 </div> 222 <div class="clear"></div> 223 </div> 224 </div> 225 </div> 226 </div> 5 <?php 6 settings_fields( 'chrs_options' ); 7 do_settings_sections( 'theme_options' ); 8 submit_button(); 9 ?> 227 10 </form> 228 11 </div> 229 12 </div> 230 13 <div class="clear"></div> 14 15 <script type="text/javascript"> 16 jQuery(document).ready(function($) { 17 $('#theme-options-form-container .codeEditor').each( function(index, value) { 18 wp.codeEditor.initialize(this, cm_settings); 19 }); 20 }); 21 </script> -
simple-theme-options/trunk/chrs-simple-options.php
r2377531 r2683948 3 3 Plugin Name: Simple Theme Options 4 4 Plugin URI: http://wordpress.org/plugins/simple-theme-options/ 5 Description: With Simple Theme Options plugin your can easily manage your custom theme options such as your social media links. You also have the option to add misc code to the header.php and footer.php files, including your analytics code.6 Version: 1. 65 Description: Easily add site-wide custom code, such as analytics tracking code, to head and/or footer sections (before the </head> or </body>). Additionally manage all your social media links, and display them on your site using shortcodes. 6 Version: 1.7 7 7 Author: Artin Hovhanesian 8 8 Author URI: https://www.chrsinteractive.com/ … … 28 28 29 29 // Make sure we don't expose any info if called directly 30 if ( basename( $_SERVER['PHP_SELF'] ) == basename( __FILE__ ) ) { 31 die( 'Sorry, but you cannot access this page directly.' ); 32 } 33 34 define( 'CHRSOP_VERSION', '1.6' ); 35 define( 'CHRSOP_REQUIRED_WP_VERSION', '4.0.0' ); 36 define( 'CHRSOP_PLUGIN_URL', plugin_dir_url( __FILE__ )); 37 define( 'CHRSOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 38 39 add_action( 'admin_enqueue_scripts', 'chrs_options_style' ); 40 add_action( 'admin_init', 'chrs_theme_options_init' ); 41 add_action( 'admin_menu', 'chrs_theme_options_add' ); 42 add_action( 'admin_head', 'chrs_theme_options_icon' ); 43 add_action( 'wp_head', 'chrs_add_header' ); 44 add_action( 'wp_footer', 'chrs_add_footer' ); 45 46 function chrs_options_style() { 47 wp_enqueue_style( 'chrs_options', plugin_dir_url( __FILE__ ) . '/css/styles.css', false, '1.2.0' ); 48 } 49 50 function chrs_theme_options_init(){ 51 register_setting( 'chrs_options', 'chrs_theme_options'); 52 } 53 54 55 function chrs_theme_options_add() { 56 add_menu_page( __( 'Theme Options', 'chrssto' ), __( 'Theme Options', 'chrssto' ), 'edit_theme_options', 'theme_options', 'chrs_theme_options_do' ); 57 } 58 59 60 function chrs_theme_options_do() { 61 global $select_options; 62 if ( ! isset( $_REQUEST['settings-updated'] ) ) 63 $_REQUEST['settings-updated'] = false; 64 65 66 echo '<div class="chrs-settings-block">'; 67 if ( false !== $_REQUEST['settings-updated'] ) : 68 echo '<div class="updated">'; 69 echo '<p>'; 70 _e( 'Options saved', 'chrssto' ); 71 echo '</p>'; 72 echo '</div>'; 73 endif; 74 echo '</div>'; 75 76 require_once( CHRSOP_PLUGIN_DIR . 'input-global.php' ); 77 require_once( CHRSOP_PLUGIN_DIR . 'instructions.php' ); 78 79 } 80 81 require_once( CHRSOP_PLUGIN_DIR . 'shortcodes.php' ); 30 if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { 31 die('Sorry, but you cannot access this page directly.'); 32 } 33 34 define('CHRSOP_VERSION', '1.7'); 35 define('CHRSOP_REQUIRED_WP_VERSION', '5.0.0'); 36 define('CHRSOP_PLUGIN_URL', plugin_dir_url(__FILE__)); 37 define('CHRSOP_PLUGIN_DIR', plugin_dir_path(__FILE__)); 38 39 add_action('admin_enqueue_scripts', 'chrs_options_style'); 40 add_action('admin_init', 'chrs_theme_options_init'); 41 add_action('admin_menu', 'chrs_theme_options_add'); 42 add_action('admin_head', 'chrs_theme_options_icon'); 43 add_action('wp_head', 'chrs_add_header'); 44 add_action('wp_footer', 'chrs_add_footer'); 45 46 function chrs_options_style($hook) 47 { 48 wp_enqueue_style('chrs_options', plugin_dir_url(__FILE__) . '/css/styles.css', false, '1.2.0'); 49 // Load Codemirror Assets. 50 51 if ( 'toplevel_page_theme_options' === $hook ) { 52 $cm_settings['codeEditor'] = wp_enqueue_code_editor( [ 'type' => 'text/html' ] ); 53 wp_localize_script( 'code-editor', 'cm_settings', $cm_settings ); 54 wp_enqueue_style( 'wp-codemirror' ); 55 wp_enqueue_script( 'wp-codemirror' ); 56 } 57 } 58 59 function chrs_theme_options_init() 60 { 61 register_setting('chrs_options', 'chrs_theme_options', array( 62 'sanitize_callback' => function ($options) { 63 if (!current_user_can('unfiltered_html')) { 64 foreach (array('analytics', 'customCodeHeader', 'customCodeFooter') as $key) { 65 $options[$key] = esc_html($options[$key]); 66 } 67 } 68 69 return $options; 70 }, 71 )); 72 73 $options = get_option('chrs_theme_options'); 74 75 if (current_user_can('unfiltered_html')) { 76 //@see https://developer.wordpress.org/reference/functions/add_settings_section/ 77 // add_settings_section( $id, $title, $callback, $page ) 78 add_settings_section( 79 'chrs_options_code', 80 esc_html__('Global Settings', 'chrssto'), 81 '', 82 'theme_options' 83 ); 84 85 /** 86 * Register a settings field to a settings page and section. 87 * This is part of the Settings API, which lets you automatically generate 88 * wp-admin settings pages by registering your settings and using a few 89 * callbacks to control the output. 90 */ 91 // add_settings_field( $id, $title, $callback, $page, $section, $args ) 92 add_settings_field( 93 'chrs_theme_options_analytics', 94 __('Google Analytics', 'chrssto'), 95 'chrs_textarea_field_render', 96 'theme_options', 97 'chrs_options_code', 98 [ 99 'id' => 'analytics', 100 'value' => $options['analytics'], 101 'description' => __('Add your Google Analytics code here.', 'chrssto'), 102 'field_class' => 'large-text codeEditor', 103 ] 104 ); 105 add_settings_field( 106 'chrs_theme_options_customHeader', 107 __('Other Code<br />add to header.php', 'chrssto'), 108 'chrs_textarea_field_render', 109 'theme_options', 110 'chrs_options_code', 111 [ 112 'id' => 'customCodeHeader', 113 'value' => $options['customCodeHeader'], 114 'description' => __('Any custom code that needs to be added to header.php', 'chrssto'), 115 'field_class' => 'large-text codeEditor', 116 ] 117 ); 118 add_settings_field( 119 'chrs_theme_options_customCodeFooter', 120 __('Other Code<br />add to footer.php', 'chrssto'), 121 'chrs_textarea_field_render', 122 'theme_options', 123 'chrs_options_code', 124 [ 125 'id' => 'customCodeFooter', 126 'value' => $options['customCodeFooter'], 127 'description' => __('Any custom code that needs to be added to footer.php', 'chrssto'), 128 'field_class' => 'large-text codeEditor', 129 ] 130 ); 131 } 132 add_settings_section( 133 'chrs_options_social', 134 esc_html__('Social Media', 'chrssto'), 135 '', 136 'theme_options' 137 ); 138 139 $socials = array( 140 array( 141 'description' => 'Facebook URL', 142 'id' => 'fburl', 143 'example' => 'http://facebook.com/yourprofileurl' 144 ), 145 array( 146 'description' => 'Twitter URL', 147 'id' => 'twurl', 148 'example' => 'http://twitter.com/yourprofileurl' 149 ), 150 array( 151 'description' => 'Instagram URL', 152 'id' => 'igurl', 153 'example' => 'http://instagram.com/yourprofileurl' 154 ), 155 array( 156 'description' => 'WhatsApp URL', 157 'id' => 'waurl', 158 'example' => 'https://wa.me/1234567890' 159 ), 160 array( 161 'description' => 'Google+ URL', 162 'id' => 'gpurl', 163 'example' => 'https://plus.google.com/xxxxxxxxx/posts' 164 ), 165 array( 166 'description' => 'Pinterest URL', 167 'id' => 'pturl', 168 'example' => 'http://www.pinterest.com/yourprofileurl' 169 ), 170 array( 171 'description' => 'Youtube URL', 172 'id' => 'yturl', 173 'example' => 'http://www.youtube.com/user/yourprofileurl' 174 ), 175 array( 176 'description' => 'TikTok URL', 177 'id' => 'tturl', 178 'example' => 'https://www.tiktok.com/@yourprofileurl' 179 ), 180 array( 181 'description' => 'Yelp URL', 182 'id' => 'ypurl', 183 'example' => 'http://www.yelp.com/biz/yourprofileurl' 184 ), 185 array( 186 'description' => 'Snapchat URL', 187 'id' => 'scurl', 188 'example' => 'https://snapchat.com/add/username' 189 ), 190 array( 191 'description' => 'Discord URL', 192 'id' => 'diurl', 193 'example' => 'https://discord.gg/123ABC' 194 ), 195 array( 196 'description' => 'WordPress.com URL', 197 'id' => 'wpurl', 198 'example' => 'http://yourprofile.wordpress.com' 199 ), 200 array( 201 'description' => 'Linkedin URL', 202 'id' => 'liurl', 203 'example' => 'https://www.linkedin.com/in/yourprofile' 204 ), 205 array( 206 'description' => 'Tumblr URL', 207 'id' => 'tburl', 208 'example' => 'https://yourprofile.tumblr.com' 209 ), 210 array( 211 'description' => 'Flickr URL', 212 'id' => 'fkurl', 213 'example' => 'https://www.flickr.com/photos/yourprofile/' 214 ), 215 array( 216 'description' => 'MySpace URL', 217 'id' => 'msurl', 218 'example' => 'https://myspace.com/yourprofile' 219 ), 220 array( 221 'description' => 'Custom 1', 222 'id' => 'ct1url', 223 'example' => 'http://anyurl.com' 224 ), 225 array( 226 'description' => 'Custom 2', 227 'id' => 'ct2url', 228 'example' => 'http://anyurl.com' 229 ), 230 ); 231 foreach ($socials as $social) { 232 233 add_settings_field( 234 'chrs_theme_options_' . $social['id'], 235 __($social['description'], 'chrssto'), 236 'chrs_field_social_render', 237 'theme_options', 238 'chrs_options_social', 239 [ 240 'id' => $social['id'], 241 'value' => $options[$social['id']], 242 'example' => $social['example'], 243 ] 244 ); 245 } 246 } 247 248 function chrs_field_social_render($args) 249 { 250 printf('<input id="chrs_theme_options[%1$s]" type="text" name="chrs_theme_options[%1$s]" value="%2$s" /><br /> 251 <label for="chrs_theme_options[%1$s]">%3$s</label>', 252 $args['id'], 253 esc_url($args['value']), 254 __($args['example'], 'chrssto') 255 ); 256 } 257 258 function chrs_textarea_field_render($args) 259 { 260 printf('<textarea id="chrs_theme_options_%1$s" class="%4$s" cols="50" rows="10" name="chrs_theme_options[%1$s]">%2$s</textarea><br /> 261 <label for="chrs_theme_options_%1$s">%3$s</label>', 262 $args['id'], 263 $args['value'], 264 $args['description'], 265 //don't use class, cause it will be assigned to <tr> form element also 266 $args['field_class'] 267 ); 268 } 269 270 function chrs_theme_options_add() 271 { 272 add_menu_page(__('Theme Options', 'chrssto'), __('Theme Options', 'chrssto'), 'edit_theme_options', 'theme_options', 'chrs_theme_options_do'); 273 } 274 275 276 function chrs_theme_options_do() 277 { 278 global $select_options; 279 if (!isset($_REQUEST['settings-updated'])) 280 $_REQUEST['settings-updated'] = false; 281 282 283 echo '<div class="chrs-settings-block">'; 284 if (false !== $_REQUEST['settings-updated']) : 285 echo '<div class="updated">'; 286 echo '<p>'; 287 _e('Options saved', 'chrssto'); 288 echo '</p>'; 289 echo '</div>'; 290 endif; 291 echo '</div>'; 292 293 require_once(CHRSOP_PLUGIN_DIR . 'input-global.php'); 294 require_once(CHRSOP_PLUGIN_DIR . 'instructions.php'); 295 296 } 297 298 require_once(CHRSOP_PLUGIN_DIR . 'shortcodes.php'); 82 299 83 300 function chrs_add_header() 84 301 { 85 $themeOptions = get_option( 'chrs_theme_options');86 echo $themeOptions['analytics'];87 echo $themeOptions['customCodeHeader'];302 $themeOptions = get_option('chrs_theme_options'); 303 echo ($themeOptions['analytics']); 304 echo ($themeOptions['customCodeHeader']); 88 305 } 89 306 90 307 function chrs_add_footer() 91 308 { 92 $themeOptions = get_option( 'chrs_theme_options' ); 93 echo $themeOptions['customCodeFooter']; 94 } 95 96 function chrs_theme_options_icon() { 97 echo ' 309 $themeOptions = get_option('chrs_theme_options'); 310 echo ($themeOptions['customCodeFooter']); 311 } 312 313 function chrs_theme_options_icon() 314 { 315 echo ' 98 316 <style> 99 317 #adminmenu #toplevel_page_theme_options div.wp-menu-image:before { content: "\f348"; } -
simple-theme-options/trunk/input-global.php
r2377531 r2683948 1 2 1 <div class="wrap"> 3 2 <h2>Simple Theme Options</h2> 4 <div id=" wpcom-stats-meta-box-container" class="metabox-holder">3 <div id="theme-options-form-container" class="metabox-holder"> 5 4 <form method="post" action="options.php"> 6 <?php settings_fields( 'chrs_options' ); ?> 7 <?php $options = get_option( 'chrs_theme_options' ); ?> 8 <div class="postbox-container" style="width: 55%;margin-right: 10px;"> 9 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 10 <div class="postbox" id="chrs-global-settings"> 11 <h3 class="hndle"><span>Global Settings</span></h3> 12 <div class="inside"> 13 <table cellpadding="0" class="chrs-input-global-fields"> 14 <tbody> 15 <tr> 16 <th width="30%" align="left" valign="top" scope="row"><?php _e( 'Google Analytics', 'chrssto' ); ?></th> 17 <td width="5%"></td> 18 <td align="left"> 19 <textarea id="chrs_theme_options[analytics]" class="large-text" cols="50" rows="10" name="chrs_theme_options[analytics]"><?php echo esc_textarea( $options['analytics'] ); ?></textarea><br /> 20 <label for="chrs_theme_options[analytics]"><?php _e( 'Add your Google Analytics code here.', 'chrssto' ); ?></label></td> 21 </tr> 22 <tr> 23 <th align="left" valign="top" scope="row"><?php _e( 'Other Code<br />add to header.php', 'chrssto' ); ?></th> 24 <td></td> 25 <td align="left"><textarea id="chrs_theme_options[customCodeHeader]" class="large-text" cols="50" rows="10" name="chrs_theme_options[customCodeHeader]"><?php echo esc_textarea( $options['customCodeHeader'] ); ?></textarea> 26 <label for="chrs_theme_options[customCodeHeader]"> 27 <?php _e( 'Any custom code that needs to be added to header.php', 'chrssto' ); ?> 28 </label></td> 29 </tr> 30 <tr> 31 <th align="left" valign="top" scope="row"><?php _e( 'Other Code<br />add to footer.php', 'chrssto' ); ?></th> 32 <td></td> 33 <td align="left"><textarea id="chrs_theme_options[customCodeFooter]" class="large-text" cols="50" rows="10" name="chrs_theme_options[customCodeFooter]"><?php echo esc_textarea( $options['customCodeFooter'] ); ?></textarea> 34 <label for="chrs_theme_options[customCodeFooter]"> 35 <?php _e( 'Any custom code that needs to be added to footer.php', 'chrssto' ); ?> 36 </label></td> 37 </tr> 38 </tbody> 39 </table> 40 41 </div> 42 <div id="major-publishing-actions"> 43 <div id="publishing-action"> 44 <input type="submit" name="save" id="save" class="button button-primary" value="<?php _e( 'Save Options', 'chrssto' ); ?>" /> 45 </div> 46 <div class="clear"></div> 47 </div> 48 </div> 49 </div> 50 </div> 51 <div class="postbox-container" style="width: 44%;"> 52 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 53 <div class="postbox" id="chrs-social-settings"> 54 <h3 class="hndle"><span>Social Media</span></h3> 55 <div class="inside"> 56 <table cellpadding="0" class="chrs-input-social-fields"> 57 <tr> 58 <th width="40%" align="left" valign="top" scope="row"><?php _e( 'Facebook URL', 'chrssto' ); ?></th> 59 <td width="5%"></td> 60 <td align="left"><input id="chrs_theme_options[fburl]" type="text" name="chrs_theme_options[fburl]" value="<?php esc_attr_e( $options['fburl'] ); ?>" /><br /> 61 <label for="chrs_theme_options[fburl]"> 62 <?php _e( 'http://facebook.com/yourprofileurl', 'chrssto' ); ?> 63 </label></td> 64 </tr> 65 <tr> 66 <th align="left" valign="top" scope="row"><?php _e( 'Twitter URL', 'chrssto' ); ?></th> 67 <td></td> 68 <td align="left"><input id="chrs_theme_options[twurl]" type="text" name="chrs_theme_options[twurl]" value="<?php esc_attr_e( $options['twurl'] ); ?>" /><br /> 69 <label for="chrs_theme_options[twurl]"> 70 <?php _e( 'http://twitter.com/yourprofileurl', 'chrssto' ); ?> 71 </label></td> 72 </tr> 73 <tr> 74 <th align="left" valign="top" scope="row"><?php _e( 'Instagram URL', 'chrssto' ); ?></th> 75 <td></td> 76 <td align="left"><input id="chrs_theme_options[igurl]" type="text" name="chrs_theme_options[igurl]" value="<?php esc_attr_e( $options['igurl'] ); ?>" /><br /> 77 <label for="chrs_theme_options[igurl]"> 78 <?php _e( 'http://instagram.com/yourprofileurl', 'chrssto' ); ?> 79 </label></td> 80 </tr> 81 <tr> 82 <th align="left" valign="top" scope="row"><?php _e( 'WhatsApp URL', 'chrssto' ); ?></th> 83 <td></td> 84 <td align="left"><input id="chrs_theme_options[waurl]" type="text" name="chrs_theme_options[waurl]" value="<?php esc_attr_e( $options['waurl'] ); ?>" /><br /> 85 <label for="chrs_theme_options[waurl]"> 86 <?php _e( 'https://wa.me/1234567890', 'chrssto' ); ?> 87 </label></td> 88 </tr> 89 <tr> 90 <th align="left" valign="top" scope="row"><?php _e( 'Google+ URL', 'chrssto' ); ?></th> 91 <td></td> 92 <td align="left"><input id="chrs_theme_options[gpurl]" type="text" name="chrs_theme_options[gpurl]" value="<?php esc_attr_e( $options['gpurl'] ); ?>" /><br /> 93 <label for="chrs_theme_options[gpurl]"> 94 <?php _e( 'https://plus.google.com/xxxxxxxxx/posts', 'chrssto' ); ?> 95 </label></td> 96 </tr> 97 <tr> 98 <th align="left" valign="top" scope="row"><?php _e( 'Pinterest URL', 'chrssto' ); ?></th> 99 <td></td> 100 <td align="left"><input id="chrs_theme_options[pturl]" type="text" name="chrs_theme_options[pturl]" value="<?php esc_attr_e( $options['pturl'] ); ?>" /><br /> 101 <label for="chrs_theme_options[pturl]"> 102 <?php _e( 'http://www.pinterest.com/yourprofileurl', 'chrssto' ); ?> 103 </label></td> 104 </tr> 105 <tr> 106 <th align="left" valign="top" scope="row"><?php _e( 'Youtube URL', 'chrssto' ); ?></th> 107 <td></td> 108 <td align="left"><input id="chrs_theme_options[yturl]" type="text" name="chrs_theme_options[yturl]" value="<?php esc_attr_e( $options['yturl'] ); ?>" /><br /> 109 <label for="chrs_theme_options[yturl]"> 110 <?php _e( 'http://www.youtube.com/user/yourprofileurl', 'chrssto' ); ?> 111 </label></td> 112 </tr> 113 <tr> 114 <th align="left" valign="top" scope="row"><?php _e( 'TikTok URL', 'chrssto' ); ?></th> 115 <td></td> 116 <td align="left"><input id="chrs_theme_options[tturl]" type="text" name="chrs_theme_options[tturl]" value="<?php esc_attr_e( $options['tturl'] ); ?>" /><br /> 117 <label for="chrs_theme_options[tturl]"> 118 <?php _e( 'https://www.tiktok.com/@yourprofileurl', 'chrssto' ); ?> 119 </label></td> 120 </tr> 121 <tr> 122 <th align="left" valign="top" scope="row"><?php _e( 'Yelp URL', 'chrssto' ); ?></th> 123 <td></td> 124 <td align="left"><input id="chrs_theme_options[ypurl]" type="text" name="chrs_theme_options[ypurl]" value="<?php esc_attr_e( $options['ypurl'] ); ?>" /><br /> 125 <label for="chrs_theme_options[ypurl]"> 126 <?php _e( 'http://www.yelp.com/biz/yourprofileurl', 'chrssto' ); ?> 127 </label></td> 128 </tr> 129 <tr> 130 <th align="left" valign="top" scope="row"><?php _e( 'Snapchat URL', 'chrssto' ); ?></th> 131 <td></td> 132 <td align="left"><input id="chrs_theme_options[scurl]" type="text" name="chrs_theme_options[scurl]" value="<?php esc_attr_e( $options['scurl'] ); ?>" /><br /> 133 <label for="chrs_theme_options[scurl]"> 134 <?php _e( 'https://snapchat.com/add/username', 'chrssto' ); ?> 135 </label></td> 136 </tr> 137 <tr> 138 <th align="left" valign="top" scope="row"><?php _e( 'Discord URL', 'chrssto' ); ?></th> 139 <td></td> 140 <td align="left"><input id="chrs_theme_options[diurl]" type="text" name="chrs_theme_options[diurl]" value="<?php esc_attr_e( $options['diurl'] ); ?>" /><br /> 141 <label for="chrs_theme_options[diurl]"> 142 <?php _e( 'https://discord.gg/123ABC', 'chrssto' ); ?> 143 </label></td> 144 </tr> 145 <tr> 146 <th align="left" valign="top" scope="row"><?php _e( 'WordPress.com URL', 'chrssto' ); ?></th> 147 <td></td> 148 <td align="left"><input id="chrs_theme_options[wpurl]" type="text" name="chrs_theme_options[wpurl]" value="<?php esc_attr_e( $options['wpurl'] ); ?>" /><br /> 149 <label for="chrs_theme_options[wpurl]"> 150 <?php _e( 'http://yourprofile.wordpress.com', 'chrssto' ); ?> 151 </label></td> 152 </tr> 153 <tr> 154 <th align="left" valign="top" scope="row"><?php _e( 'Linkedin URL', 'chrssto' ); ?></th> 155 <td></td> 156 <td align="left"><input id="chrs_theme_options[liurl]" type="text" name="chrs_theme_options[liurl]" value="<?php esc_attr_e( $options['liurl'] ); ?>" /><br /> 157 <label for="chrs_theme_options[liurl]"> 158 <?php _e( 'https://www.linkedin.com/in/yourprofile', 'chrssto' ); ?> 159 </label></td> 160 </tr> 161 <tr> 162 <th align="left" valign="top" scope="row"><?php _e( 'Tumblr URL', 'chrssto' ); ?></th> 163 <td></td> 164 <td align="left"><input id="chrs_theme_options[tburl]" type="text" name="chrs_theme_options[tburl]" value="<?php esc_attr_e( $options['tburl'] ); ?>" /><br /> 165 <label for="chrs_theme_options[tburl]"> 166 <?php _e( 'https://yourprofile.tumblr.com', 'chrssto' ); ?> 167 </label></td> 168 </tr> 169 <tr> 170 <th align="left" valign="top" scope="row"><?php _e( 'Flickr URL', 'chrssto' ); ?></th> 171 <td></td> 172 <td align="left"><input id="chrs_theme_options[fkurl]" type="text" name="chrs_theme_options[fkurl]" value="<?php esc_attr_e( $options['fkurl'] ); ?>" /><br /> 173 <label for="chrs_theme_options[fkurl]"> 174 <?php _e( 'https://www.flickr.com/photos/yourprofile/', 'chrssto' ); ?> 175 </label></td> 176 </tr> 177 <tr> 178 <th align="left" valign="top" scope="row"><?php _e( 'MySpace URL', 'chrssto' ); ?></th> 179 <td></td> 180 <td align="left"><input id="chrs_theme_options[msurl]" type="text" name="chrs_theme_options[msurl]" value="<?php esc_attr_e( $options['msurl'] ); ?>" /><br /> 181 <label for="chrs_theme_options[msurl]"> 182 <?php _e( 'https://myspace.com/yourprofile', 'chrssto' ); ?> 183 </label></td> 184 </tr> 185 <tr> 186 <th align="left" valign="top" scope="row"><?php _e( 'Custom 1', 'chrssto' ); ?></th> 187 <td></td> 188 <td align="left"><input id="chrs_theme_options[ct1url]" type="text" name="chrs_theme_options[ct1url]" value="<?php esc_attr_e( $options['ct1url'] ); ?>" /><br /> 189 <label for="chrs_theme_options[ct1url]"> 190 <?php _e( 'http://anyurl.com', 'chrssto' ); ?> 191 </label></td> 192 </tr> 193 <tr> 194 <th align="left" valign="top" scope="row"><?php _e( 'Custom 2', 'chrssto' ); ?></th> 195 <td></td> 196 <td align="left"><input id="chrs_theme_options[ct2url]" type="text" name="chrs_theme_options[ct2url]" value="<?php esc_attr_e( $options['ct2url'] ); ?>" /><br /> 197 <label for="chrs_theme_options[ct2url]"> 198 <?php _e( 'http://anyurl.com', 'chrssto' ); ?> 199 </label></td> 200 </tr> 201 </table> 202 </div> 203 <div id="major-publishing-actions"> 204 <div id="publishing-action"> 205 <input type="submit" name="save" id="save" class="button button-primary" value="<?php _e( 'Save Options', 'chrssto' ); ?>" /> 206 </div> 207 <div class="clear"></div> 208 </div> 209 </div> 210 </div> 211 </div> 5 <?php 6 settings_fields( 'chrs_options' ); 7 do_settings_sections( 'theme_options' ); 8 submit_button(); 9 ?> 212 10 </form> 213 11 </div> 214 12 </div> 215 13 <div class="clear"></div> 14 15 <script type="text/javascript"> 16 jQuery(document).ready(function($) { 17 $('#theme-options-form-container .codeEditor').each( function(index, value) { 18 wp.codeEditor.initialize(this, cm_settings); 19 }); 20 }); 21 </script> -
simple-theme-options/trunk/instructions.php
r2377531 r2683948 14 14 <tr> 15 15 <th>Facebook</th> 16 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['fburl'];</span></td>16 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['fburl']);</span></td> 17 17 <td><span>[social-link social_id="fburl" link_title="Facebook"]</span></td> 18 18 </tr> 19 19 <tr> 20 20 <th>Twitter</th> 21 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['twurl'];</span></td>21 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['twurl']);</span></td> 22 22 <td><span>[social-link social_id="twurl" link_title="Twitter"]</span></td> 23 23 </tr> 24 24 <tr> 25 25 <th>Instagram</th> 26 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['igurl'];</span></td>26 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['igurl']);</span></td> 27 27 <td><span>[social-link social_id="igurl" link_title="Instagram"]</span></td> 28 28 </tr> 29 29 <tr> 30 30 <th>WhatsApp</th> 31 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['waurl'];</span></td>31 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['waurl']);</span></td> 32 32 <td><span>[social-link social_id="waurl" link_title="WhatsApp"]</span></td> 33 33 </tr> 34 34 <tr> 35 35 <th>Google+</th> 36 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['gpurl'];</span></td>36 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['gpurl']);</span></td> 37 37 <td><span>[social-link social_id="gpurl" link_title="Google+"]</span></td> 38 38 </tr> 39 39 <tr> 40 40 <th>Pinterest</th> 41 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['pturl'];</span></td>41 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['pturl']);</span></td> 42 42 <td><span>[social-link social_id="pturl" link_title="Pinterest"]</span></td> 43 43 </tr> 44 44 <tr> 45 45 <th>Youtube</th> 46 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['yturl'];</span></td>46 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['yturl']);</span></td> 47 47 <td><span>[social-link social_id="yturl" link_title="Youtube"]</span></td> 48 48 </tr> 49 49 <tr> 50 50 <th>TikTok</th> 51 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['tturl'];</span></td>51 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['tturl']);</span></td> 52 52 <td><span>[social-link social_id="tturl" link_title="TikTok"]</span></td> 53 53 </tr> 54 54 <tr> 55 55 <th>Yelp</th> 56 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['ypurl'];</span></td>56 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['ypurl']);</span></td> 57 57 <td><span>[social-link social_id="ypurl" link_title="Yelp"]</span></td> 58 58 </tr> 59 59 <tr> 60 60 <th>Snapchat</th> 61 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['scurl'];</span></td>61 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['scurl']);</span></td> 62 62 <td><span>[social-link social_id="scurl" link_title="Snapchat"]</span></td> 63 63 </tr> 64 64 <tr> 65 65 <th>Discord</th> 66 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['diurl'];</span></td>66 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['diurl']);</span></td> 67 67 <td><span>[social-link social_id="diurl" link_title="Discord"]</span></td> 68 68 </tr> 69 69 <tr> 70 70 <th>Wordpress</th> 71 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['wpurl'];</span></td>71 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['wpurl']);</span></td> 72 72 <td><span>[social-link social_id="wpurl" link_title="WordPress"]</span></td> 73 73 </tr> 74 74 <tr> 75 75 <th>LinkedIn</th> 76 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['liurl'];</span></td>76 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['liurl']);</span></td> 77 77 <td><span>[social-link social_id="liurl" link_title="Linkedin"]</span></td> 78 78 </tr> 79 79 <tr> 80 80 <th>Tumblr</th> 81 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['tburl'];</span></td>81 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['tburl']);</span></td> 82 82 <td><span>[social-link social_id="tburl" link_title="Tumblr"]</span></td> 83 83 </tr> 84 84 <tr> 85 85 <th>Flickr</th> 86 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['fkurl'];</span></td>86 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['fkurl']);</span></td> 87 87 <td><span>[social-link social_id="fkurl" link_title="Flickr"]</span></td> 88 88 </tr> 89 89 <tr> 90 90 <th>MySpace</th> 91 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['msurl'];</span></td>91 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['msurl']);</span></td> 92 92 <td><span>[social-link social_id="msurl" link_title="MySpace"]</span></td> 93 93 </tr> 94 94 <tr> 95 95 <th>Custom 1</th> 96 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['ct1url'];</span></td>96 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['ct1url']);</span></td> 97 97 <td><span>[social-link social_id="ct1url" link_title="Link Title"]</span></td> 98 98 </tr> 99 99 <tr> 100 100 <th>Custom 2</th> 101 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo $themeOptions['ct2url'];</span></td>101 <td><span>$themeOptions = get_option( 'chrs_theme_options' ); echo esc_url($themeOptions['ct2url']);</span></td> 102 102 <td><span>[social-link social_id="ct2url" link_title="Link Title"]</span></td> 103 103 </tr> -
simple-theme-options/trunk/readme.txt
r2377531 r2683948 2 2 Contributors: chrsinteractive 3 3 Plugin URI: https://www.chrsinteractive.com 4 Tags: theme options, social media, analytics, admin, edit, shortcode5 Requires at least: 4.0.06 Tested up to: 5. 5.07 Stable tag: 1. 64 Tags: head, header, footer, body, scripts, wp_head, wp_footer, wp_body_open, head footer code, custom, theme options, social media, analytics 5 Requires at least: 5.0 6 Tested up to: 5.9.1 7 Stable tag: 1.7 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 With Simple Theme Options plugin your can easily manage your custom theme options such as social media links and Google Analytics code. 11 Easily add site-wide custom code, such as analytics tracking code, to head and/or footer sections (before the </head> or </body>). Additionally manage all your social media links, and display them on your site using shortcodes. 12 12 13 13 14 == Description == 14 15 15 The plugin adds an admin interface where you can manage custom theme options.16 **Simple Theme Options** adds an admin interface where you can add custom code snippets (JavaScript, CSS, or HTML), easily without any coding knowledge. The custom code can be added, site wide, before the `<head>`, and/ore just before `</body>`. 16 17 17 - Add analytics code 18 - Add any misc code to header.php and footer.php 19 - Add social media links (Facebook, Twitter, etc.) 18 Examples of code that you can add are: 19 - Google Analytics code 20 - Pixel Tracking 21 - Heatmap 22 - Site Verification code 23 - Webfont link 24 - and more... 20 25 21 26 … … 68 73 == Changelog == 69 74 75 = 1.7 = 76 * Improve Security updates 77 * Minor Compatible with WordPress 5.9.1 78 70 79 = 1.6 = 71 80 * Added TikTok -
simple-theme-options/trunk/shortcodes.php
r1069034 r2683948 6 6 ), $atts ) ); 7 7 8 ob_start(); 8 9 9 $themeOptions = get_option( 'chrs_theme_options' ); 10 echo '<a href="'.$themeOptions[$social_id].'">'.$link_title.'</a>'; 11 return ob_get_clean(); 10 return '<a href="'.esc_url($themeOptions[$social_id]).'">'.$link_title.'</a>'; 12 11 } 13 12 add_shortcode( 'social-link', 'chrs_social_links' ); 14 15 ?>
Note: See TracChangeset
for help on using the changeset viewer.