users.php (8286B)
1 <?php 2 /** 3 * Redux Pro User Meta config. 4 * For full documentation, please visit: http:https://devs.redux.io/ 5 * 6 * @package Redux Pro 7 */ 8 9 defined( 'ABSPATH' ) || exit; 10 11 if ( ! class_exists( 'Redux_Users' ) ) { 12 return; 13 } 14 15 // Change the priority the Redux_Users boxes appear. 16 Redux_Users::set_Args( 17 $opt_name, 18 array( 19 'user_priority' => 50, 20 ) 21 ); 22 23 Redux_Users::set_profile( 24 $opt_name, 25 array( 26 'id' => 'demo-users', 27 'title' => esc_html__( 'Cool Options', 'your-textdomain-here' ), 28 'style' => 'wp', 29 'sections' => array( 30 array( 31 'title' => esc_html__( 'Home Settings', 'your-textdomain-here' ), 32 'icon' => 'el-icon-home', 33 'fields' => array( 34 array( 35 'id' => 'user-text', 36 'type' => 'text', 37 'title' => esc_html__( 'Input 1', 'your-textdomain-here' ), 38 ), 39 array( 40 'id' => 'user-text-2', 41 'type' => 'text', 42 'required' => array( 'user-text', '=', 'two' ), 43 'title' => esc_html__( 'Input 2', 'your-textdomain-here' ), 44 ), 45 array( 46 'id' => 'user-text-3', 47 'type' => 'text', 48 'title' => esc_html__( 'Input 3', 'your-textdomain-here' ), 49 ), 50 array( 51 'id' => 'webFonts', 52 'type' => 'media', 53 'title' => esc_html__( 'Web Fonts', 'your-textdomain-here' ), 54 'compiler' => 'true', 55 'mode' => false, 56 // Can be set to false to allow any media type, or can also be set to any mime type. 57 'desc' => esc_html__( 'Basic media uploader with disabled URL input field.', 'your-textdomain-here' ), 58 'subtitle' => esc_html__( 'Upload any media using the WordPress native uploader', 'your-textdomain-here' ), 59 ), 60 array( 61 'id' => 'section-media-start', 62 'type' => 'section', 63 'title' => esc_html__( 'Media Options', 'your-textdomain-here' ), 64 'subtitle' => esc_html__( 'With the "section" field you can create indent option sections.', 'your-textdomain-here' ), 65 'indent' => true, 66 ), 67 array( 68 'id' => 'mediaurl', 69 'type' => 'media', 70 'url' => true, 71 'title' => esc_html__( 'Media w/ URL', 'your-textdomain-here' ), 72 'compiler' => 'true', 73 'desc' => esc_html__( 'Basic media uploader with disabled URL input field.', 'your-textdomain-here' ), 74 'subtitle' => esc_html__( 'Upload any media using the WordPress native uploader', 'your-textdomain-here' ), 75 'default' => array( 'url' => 'http://s.wordpress.org/style/images/codeispoetry.png' ), 76 ), 77 array( 78 'id' => 'section-media-end', 79 'type' => 'section', 80 'indent' => false, 81 ), 82 array( 83 'id' => 'media-nourl', 84 'type' => 'media', 85 'title' => esc_html__( 'Media w/o URL', 'your-textdomain-here' ), 86 'desc' => esc_html__( 'This represents the minimalistic view. It does not have the preview box or the display URL in an input box. ', 'your-textdomain-here' ), 87 'subtitle' => esc_html__( 'Upload any media using the WordPress native uploader', 'your-textdomain-here' ), 88 ), 89 array( 90 'id' => 'media-nopreview', 91 'type' => 'media', 92 'preview' => false, 93 'title' => esc_html__( 'Media No Preview', 'your-textdomain-here' ), 94 'desc' => esc_html__( 'This represents the minimalistic view. It does not have the preview box or the display URL in an input box. ', 'your-textdomain-here' ), 95 'subtitle' => esc_html__( 'Upload any media using the WordPress native uploader', 'your-textdomain-here' ), 96 ), 97 array( 98 'id' => 'gallery', 99 'type' => 'gallery', 100 'title' => esc_html__( 'Add/Edit Gallery', 'your-textdomain-here' ), 101 'subtitle' => esc_html__( 'Create a new Gallery by selecting existing or uploading new images using the WordPress native uploader', 'your-textdomain-here' ), 102 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 103 ), 104 array( 105 'id' => 'slider1bDOVY23', 106 'type' => 'slider', 107 'title' => esc_html__( 'JQuery UI Slider Example 1', 'your-textdomain-here' ), 108 'desc' => esc_html__( 'JQuery UI slider description. Min: 1, max: 500, step: 3, default value: 45', 'your-textdomain-here' ), 109 'default' => '46', 110 'min' => '1', 111 'step' => '3', 112 'max' => '500', 113 ), 114 array( 115 'id' => 'slider2bc', 116 'type' => 'slider', 117 'title' => esc_html__( 'JQuery UI Slider Example 2 w/ Steps (5)', 'your-textdomain-here' ), 118 'desc' => esc_html__( 'JQuery UI slider description. Min: 0, max: 300, step: 5, default value: 75', 'your-textdomain-here' ), 119 'default' => '0', 120 'min' => '0', 121 'step' => '5', 122 'max' => '300', 123 ), 124 array( 125 'id' => 'spinner1bcd', 126 'type' => 'spinner', 127 'title' => esc_html__( 'JQuery UI Spinner Example 1', 'your-textdomain-here' ), 128 'desc' => esc_html__( 'JQuery UI spinner description. Min:20, max: 100, step:20, default value: 40', 'your-textdomain-here' ), 129 'default' => '40', 130 'min' => '20', 131 'step' => '20', 132 'max' => '100', 133 ), 134 array( 135 'id' => 'switch-parent', 136 'type' => 'switch', 137 'title' => esc_html__( 'Switch - Nested Children, Enable to show', 'your-textdomain-here' ), 138 'subtitle' => esc_html__( 'Look, it\'s on! Also hidden child elements!', 'your-textdomain-here' ), 139 'default' => 0, 140 'on' => 'Enabled', 141 'off' => 'Disabled', 142 ), 143 array( 144 'id' => 'switch-child1', 145 'type' => 'switch', 146 'required' => array( 'switch-parent', '=', '1' ), 147 'title' => esc_html__( 'Switch - This and the next switch required for patterns to show', 'your-textdomain-here' ), 148 'subtitle' => esc_html__( 'Also called a "fold" parent.', 'your-textdomain-here' ), 149 'desc' => esc_html__( 'Items set with a fold to this ID will hide unless this is set to the appropriate value.', 'your-textdomain-here' ), 150 'default' => false, 151 ), 152 ), 153 ), 154 array( 155 'title' => esc_html__( 'Home Layout', 'your-textdomain-here' ), 156 'icon' => 'el-icon-home', 157 'fields' => array( 158 array( 159 'id' => 'homepage_blocks', 160 'type' => 'sorter', 161 'title' => 'Homepage Layout Manager', 162 'desc' => 'Organize how you want the layout to appear on the homepage', 163 'compiler' => 'true', 164 'required' => array( 'layout', '=', '1' ), 165 'options' => array( 166 'enabled' => array( 167 'highlights' => 'Highlights', 168 'slider' => 'Slider', 169 'staticpage' => 'Static Page', 170 'services' => 'Services', 171 ), 172 'disabled' => array(), 173 ), 174 ), 175 176 array( 177 'id' => 'presets', 178 'type' => 'image_select', 179 'presets' => true, 180 'title' => esc_html__( 'Preset', 'your-textdomain-here' ), 181 'subtitle' => esc_html__( 'This allows you to set a json string or array to override multiple preferences in your theme.', 'your-textdomain-here' ), 182 'default' => 0, 183 'desc' => esc_html__( 'This allows you to set a json string or array to override multiple preferences in your theme.', 'your-textdomain-here' ), 184 'options' => array( 185 '1' => array( 186 'alt' => 'Preset 1', 187 'img' => Redux_Core::$url . '../sample/presets/preset1.png', 188 'presets' => array( 189 'switch-on' => 1, 190 'switch-off' => 1, 191 'switch-custom' => 1, 192 ), 193 ), 194 '2' => array( 195 'alt' => 'Preset 2', 196 'img' => Redux_Core::$url . '../sample/presets/preset2.png', 197 'presets' => "{'slider1':'1', 'slider2':'0', 'switch-on':'0'}", 198 ), 199 ), 200 ), 201 ), 202 ), 203 ), 204 ) 205 ); 206 207 // Recovering user data. 208 $data = Redux_Users::get_user_meta( 209 array( 210 'key' => 'user-text', /* If you're only looking for a key within the meta, otherwise all values will be returned. */ 211 'opt_name' => $opt_name, // Optional, but needed to recover default values for unset values. 212 'user' => '', // User id, else current user ID is returned. 213 ) 214 );