1 <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' ); |
1 <?php |
2 /** |
2 /** |
3 * OptionTree documentation page functions. |
3 * OptionTree Documentation Page Functions. |
4 * |
4 * |
5 * @package OptionTree |
5 * @package OptionTree |
6 * @author Derek Herman <derek@valendesigns.com> |
|
7 * @copyright Copyright (c) 2013, Derek Herman |
|
8 * @since 2.0 |
|
9 */ |
6 */ |
10 |
7 |
11 /** |
8 if ( ! defined( 'OT_VERSION' ) ) { |
12 * Creating Options option type. |
9 exit( 'No direct script access allowed' ); |
13 * |
10 } |
14 * @return string |
11 |
15 * |
|
16 * @access public |
|
17 * @since 2.0 |
|
18 */ |
|
19 if ( ! function_exists( 'ot_type_creating_options' ) ) { |
12 if ( ! function_exists( 'ot_type_creating_options' ) ) { |
20 |
13 |
21 function ot_type_creating_options() { |
14 /** |
22 |
15 * Creating Options option type. |
23 /* format setting outer wrapper */ |
16 * |
24 echo '<div class="format-setting type-textblock wide-desc">'; |
17 * @access public |
25 |
18 * @since 2.0 |
26 /* description */ |
19 */ |
27 echo '<div class="description">'; |
20 function ot_type_creating_options() { |
28 |
21 |
29 echo '<h4>'. __( 'Label', 'option-tree' ) . ':</h4>'; |
22 // Format setting outer wrapper. |
30 echo '<p>' . __( 'The Label field should be a short but descriptive block of text 100 characters or less with no HTML.', 'option-tree' ) . '</p>'; |
23 echo '<div class="format-setting type-textblock wide-desc">'; |
31 |
24 |
32 echo '<h4>'. __( 'ID', 'option-tree' ) . ':</h4>'; |
25 // Description. |
33 echo '<p>' . __( 'The ID field is a unique alphanumeric key used to differentiate each theme option (underscores are acceptable). Also, the plugin will change all text you write in this field to lowercase and replace spaces and special characters with an underscore automatically.', 'option-tree' ) . '</p>'; |
26 echo '<div class="description">'; |
34 |
27 |
35 echo '<h4>'. __( 'Type', 'option-tree' ) . ':</h4>'; |
28 echo '<h4>' . esc_html__( 'Label', 'option-tree' ) . ':</h4>'; |
36 echo '<p>' . __( 'You are required to choose one of the supported option types when creating a new option. Here is a list of the available option types. For more information about each type click the <code>Option Types</code> tab to the left.', 'option-tree' ) . '</p>'; |
29 echo '<p>' . esc_html__( 'The Label field should be a short but descriptive block of text 100 characters or less with no HTML.', 'option-tree' ) . '</p>'; |
37 |
30 |
38 echo '<ul class="docs-ul">'; |
31 echo '<h4>' . esc_html__( 'ID', 'option-tree' ) . ':</h4>'; |
39 foreach( ot_option_types_array() as $key => $value ) |
32 echo '<p>' . esc_html__( 'The ID field is a unique alphanumeric key used to differentiate each theme option (underscores are acceptable). Also, the plugin will change all text you write in this field to lowercase and replace spaces and special characters with an underscore automatically.', 'option-tree' ) . '</p>'; |
40 echo '<li>' . $value . '</li>'; |
33 |
41 echo '</ul>'; |
34 echo '<h4>' . esc_html__( 'Type', 'option-tree' ) . ':</h4>'; |
42 |
35 |
43 echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>'; |
36 /* translators: %s: option type tab */ |
44 echo '<p>' . __( 'Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree' ) . '</p>'; |
37 $string = esc_html__( 'You are required to choose one of the supported option types when creating a new option. Here is a list of the available option types. For more information about each type click the %s tab to the left.', 'option-tree' ); |
45 |
38 echo '<p>' . sprintf( $string, '<code>' . esc_html__( 'Option Types', 'option-tree' ) . '</code>' ) . '</p>'; // phpcs:ignore |
46 echo '<h4>'. __( 'Choices', 'option-tree' ) . ':</h4>'; |
39 |
47 echo '<p>' . __( 'Click the "Add Choice" button to add an item to the choices array. This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree' ) . '</p>'; |
40 echo '<ul class="docs-ul">'; |
48 |
41 foreach ( ot_option_types_array() as $key => $value ) { |
49 echo '<h4>'. __( 'Settings', 'option-tree' ) . ':</h4>'; |
42 echo '<li>' . $value . '</li>'; // phpcs:ignore |
50 echo '<p>' . __( 'Click the "Add Setting" button found inside a newly created setting to add an item to the settings array. This will only affect the List Item type.', 'option-tree' ) . '</p>'; |
43 } |
51 |
44 echo '</ul>'; |
52 echo '<h4>'. __( 'Standard', 'option-tree' ) . ':</h4>'; |
45 |
53 echo '<p>' . __( 'Setting the standard value for your option only works for some option types. Those types are one that have a single string value saved to them and not an array of values.', 'option-tree' ) . '</p>'; |
46 echo '<h4>' . esc_html__( 'Description', 'option-tree' ) . ':</h4>'; |
54 |
47 echo '<p>' . esc_html__( 'Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree' ) . '</p>'; |
55 echo '<h4>'. __( 'Rows', 'option-tree' ) . ':</h4>'; |
48 |
56 echo '<p>' . __( 'Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree' ) . '</p>'; |
49 echo '<h4>' . esc_html__( 'Choices', 'option-tree' ) . ':</h4>'; |
57 |
50 echo '<p>' . esc_html__( 'Click the "Add Choice" button to add an item to the choices array. This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree' ) . '</p>'; |
58 echo '<h4>'. __( 'Post Type', 'option-tree' ) . ':</h4>'; |
51 |
59 echo '<p>' . __( 'Add a comma separated list of post type like <code>post,page</code>. This will only affect the following option types: Custom Post Type Checkbox, & Custom Post Type Select. Below are the default post types available with WordPress and that are also compatible with OptionTree. You can also add your own custom <code>post_type</code>. At this time <code>any</code> does not seem to return results properly and is something I plan on looking into.', 'option-tree' ) . '</p>'; |
52 echo '<h4>' . esc_html__( 'Settings', 'option-tree' ) . ':</h4>'; |
60 |
53 echo '<p>' . esc_html__( 'Click the "Add Setting" button found inside a newly created setting to add an item to the settings array. This will only affect the List Item type.', 'option-tree' ) . '</p>'; |
61 echo '<ul class="docs-ul">'; |
54 |
62 echo '<li><code>post</code></li>'; |
55 echo '<h4>' . esc_html__( 'Standard', 'option-tree' ) . ':</h4>'; |
63 echo '<li><code>page</code></li>'; |
56 echo '<p>' . esc_html__( 'Setting the standard value for your option only works for some option types. Those types are one that have a single string value saved to them and not an array of values.', 'option-tree' ) . '</p>'; |
64 echo '<li><code>attachment</code></li>'; |
57 |
65 echo '</ul>'; |
58 echo '<h4>' . esc_html__( 'Rows', 'option-tree' ) . ':</h4>'; |
66 |
59 echo '<p>' . esc_html__( 'Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree' ) . '</p>'; |
67 echo '<h4>'. __( 'Taxonomy', 'option-tree' ) . ':</h4>'; |
60 |
68 echo '<p>' . __( 'Add a comma separated list of any registered taxonomy like <code>category,post_tag</code>. This will only affect the following option types: Taxonomy Checkbox, & Taxonomy Select.', 'option-tree' ) . '</p>'; |
61 echo '<h4>' . esc_html__( 'Post Type', 'option-tree' ) . ':</h4>'; |
69 |
62 |
70 echo '<h4>'. __( 'Min, Max, & Step', 'option-tree' ) . ':</h4>'; |
63 /* translators: %1$s: example value, %2$s: post_type, %3$s: using any as a value */ |
71 echo '<p>' . __( 'Add a comma separated list of options in the following format <code>0,100,1</code> (slide from <code>0-100</code> in intervals of <code>1</code>). The three values represent the minimum, maximum, and step options and will only affect the Numeric Slider option type.', 'option-tree' ) . '</p>'; |
64 $string = esc_html__( 'Add a comma separated list of post type like %1$s. This will only affect the following option types: Custom Post Type Checkbox, & Custom Post Type Select. Below are the default post types available with WordPress and that are also compatible with OptionTree. You can also add your own custom %2$s. At this time %3$s does not seem to return results properly and is something I plan on looking into.', 'option-tree' ); |
72 |
65 echo '<p>' . sprintf( $string, '<code>post,page</code>', '<code>post_type</code>', '<code>any</code>' ) . '</p>'; // phpcs:ignore |
73 echo '<h4>'. __( 'CSS Class', 'option-tree' ) . ':</h4>'; |
66 |
74 echo '<p>' . __( 'Add and optional class to any option type.', 'option-tree' ) . '</p>'; |
67 echo '<ul class="docs-ul">'; |
75 |
68 echo '<li><code>post</code></li>'; |
76 echo '<h4>'. __( 'Condition', 'option-tree' ) . ':</h4>'; |
69 echo '<li><code>page</code></li>'; |
77 echo '<p>' . sprintf( __( 'Add a comma separated list (no spaces) of conditions in which the field will be visible, leave this setting empty to always show the field. In these examples, %s is a placeholder for your condition, which can be in the form of %s.', 'option-tree' ), '<code>value</code>', '<code>field_id:is(value)</code>, <code>field_id:not(value)</code>, <code>field_id:contains(value)</code>, <code>field_id:less_than(value)</code>, <code>field_id:less_than_or_equal_to(value)</code>, <code>field_id:greater_than(value)</code>, or <code>field_id:greater_than_or_equal_to(value)</code>' ) . '</p>'; |
70 echo '<li><code>attachment</code></li>'; |
78 |
71 echo '</ul>'; |
79 echo '<h4>'. __( 'Operator', 'option-tree' ) . ':</h4>'; |
72 |
80 echo '<p>' . sprintf( __( 'Choose the logical operator to compute the result of the conditions. Your options are %s and %s.', 'option-tree' ), '<code>and</code>', '<code>or</code>' ) . '</p>'; |
73 echo '<h4>' . esc_html__( 'Taxonomy', 'option-tree' ) . ':</h4>'; |
81 |
74 |
82 echo '</div>'; |
75 /* translators: %s: example value */ |
83 |
76 $string = esc_html__( 'Add a comma separated list of any registered taxonomy like %s. This will only affect the following option types: Taxonomy Checkbox, & Taxonomy Select.', 'option-tree' ); |
84 echo '</div>'; |
77 echo '<p>' . sprintf( $string, '<code>category,post_tag</code>' ) . '</p>'; // phpcs:ignore |
85 |
78 |
86 } |
79 echo '<h4>' . esc_html__( 'Min, Max, & Step', 'option-tree' ) . ':</h4>'; |
87 |
80 |
88 } |
81 /* translators: %1$s: format, %2$s: range, %3$s: interval minimum */ |
89 |
82 $string = esc_html__( 'Add a comma separated list of options in the following format %1$s (slide from %2$s in intervals of %3$s). The three values represent the minimum, maximum, and step options and will only affect the Numeric Slider option type.', 'option-tree' ); |
90 /** |
83 echo '<p>' . sprintf( $string, '<code>0,100,1</code>', '<code>0-100</code>', '<code>1</code>' ) . '</p>'; // phpcs:ignore |
91 * ot_get_option() option type. |
84 |
92 * |
85 echo '<h4>' . esc_html__( 'CSS Class', 'option-tree' ) . ':</h4>'; |
93 * This is a callback function to display text about ot_get_option(). |
86 echo '<p>' . esc_html__( 'Add and optional class to any option type.', 'option-tree' ) . '</p>'; |
94 * |
87 |
95 * @return string |
88 echo '<h4>' . esc_html__( 'Condition', 'option-tree' ) . ':</h4>'; |
96 * |
89 |
97 * @access public |
90 /* translators: %1$s: example (value) placeholder, %2$s: list of condition examples */ |
98 * @since 2.0 |
91 $string = esc_html__( 'Add a comma separated list (no spaces) of conditions in which the field will be visible, leave this setting empty to always show the field. In these examples, %1$s is a placeholder for your condition, which can be in the form of %2$s.', 'option-tree' ); |
99 */ |
92 echo '<p>' . sprintf( $string, '<code>value</code>', '<code>field_id:is(value)</code>, <code>field_id:not(value)</code>, <code>field_id:contains(value)</code>, <code>field_id:less_than(value)</code>, <code>field_id:less_than_or_equal_to(value)</code>, <code>field_id:greater_than(value)</code>, or <code>field_id:greater_than_or_equal_to(value)</code>' ) . '</p>'; // phpcs:ignore |
|
93 |
|
94 echo '<h4>' . esc_html__( 'Operator', 'option-tree' ) . ':</h4>'; |
|
95 |
|
96 /* translators: %1$s: and value, %2$s: or value */ |
|
97 $string = esc_html__( 'Choose the logical operator to compute the result of the conditions. Your options are %1$s and %2$s.', 'option-tree' ); |
|
98 echo '<p>' . sprintf( $string, '<code>and</code>', '<code>or</code>' ) . '</p>'; // phpcs:ignore |
|
99 |
|
100 echo '</div>'; |
|
101 |
|
102 echo '</div>'; |
|
103 } |
|
104 } |
|
105 |
100 if ( ! function_exists( 'ot_type_option_types' ) ) { |
106 if ( ! function_exists( 'ot_type_option_types' ) ) { |
101 |
107 |
102 function ot_type_option_types() { |
108 /** |
103 |
109 * The ot_get_option() option type. |
104 /* format setting outer wrapper */ |
110 * |
105 echo '<div class="format-setting type-textblock wide-desc">'; |
111 * This is a callback function to display text about ot_get_option(). |
106 |
112 * |
107 /* description */ |
113 * @access public |
108 echo '<div class="description">'; |
114 * @since 2.0 |
109 |
115 */ |
110 echo '<h4>'. __( 'Background', 'option-tree' ) . ':</h4>'; |
116 function ot_type_option_types() { |
111 echo '<p>' . sprintf( __( 'The Background option type is for adding background styles to your theme either dynamically via the CSS option type below or manually with %s. The Background option type has filters that allow you to remove fields or change the defaults. For example, you can filter %s to remove unwanted fields from all Background options or an individual one. You can also filter %s. These filters allow you to fine tune the select lists for your specific needs.', 'option-tree' ), '<code>ot_get_option()</code>', '<code>ot_recognized_background_fields</code>', '<code>ot_recognized_background_repeat</code>, <code>ot_recognized_background_attachment</code>, <code>ot_recognized_background_position</code>, ' . __( 'and', 'option-tree' ) . ' <code>ot_type_background_size_choices</code>' ) . '</p>'; |
117 |
112 |
118 // Format setting outer wrapper. |
113 echo '<h4>'. __( 'Border', 'option-tree' ) . ':</h4>'; |
119 echo '<div class="format-setting type-textblock wide-desc">'; |
114 echo '<p>' . sprintf( __( 'The Border option type is used to set width, unit, style, and color values. The text input excepts a numerical value and the unit select lets you choose the unit of measurement to add to that value. Currently the default units are %s, %s, %s, and %s. However, you can change them with the %s filter. The style select lets you choose the border style. The default styles are %s, %s, %s, %s, %s, %s, %s, and %s. However, you can change them with the %s filter. The colorpicker saves a hexadecimal color code.', 'option-tree' ), '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_recognized_border_unit_types</code>', '<code>hidden</code>', '<code>dashed</code>', '<code>solid</code>', '<code>double</code>', '<code>groove</code>', '<code>ridge</code>', '<code>inset</code>', '<code>outset</code>', '<code>ot_recognized_border_style_types</code>' ) . '</p>'; |
120 |
115 |
121 // Description. |
116 echo '<h4>'. __( 'Box Shadow', 'option-tree' ) . ':</h4>'; |
122 echo '<div class="description">'; |
117 echo '<p>' . sprintf( __( 'The Box Shadow option type is used to set %s, %s, %s, %s, %s, and %s values.', 'option-tree' ), '<code>inset</code>', '<code>offset-x</code>', '<code>offset-y</code>', '<code>blur-radius</code>', '<code>spread-radius</code>', '<code>color</code>' ) . '</p>'; |
123 |
118 |
124 echo '<h4>' . esc_html__( 'Background', 'option-tree' ) . ':</h4>'; |
119 echo '<h4>'. __( 'Category Checkbox', 'option-tree' ) . ':</h4>'; |
125 |
120 echo '<p>' . __( 'The Category Checkbox option type displays a list of category IDs. It allows the user to check multiple category IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
126 /* translators: %1$s: function name, %2$s: filter name, %3$s: filter name list */ |
121 |
127 $string = esc_html__( 'The Background option type is for adding background styles to your theme either dynamically via the CSS option type below or manually with %1$s. The Background option type has filters that allow you to remove fields or change the defaults. For example, you can filter %2$s to remove unwanted fields from all Background options or an individual one. You can also filter %3$s. These filters allow you to fine tune the select lists for your specific needs.', 'option-tree' ); |
122 echo '<h4>'. __( 'Category Select', 'option-tree' ) . ':</h4>'; |
128 echo '<p>' . sprintf( $string, '<code>ot_get_option()</code>', '<code>ot_recognized_background_fields</code>', '<code>ot_recognized_background_repeat</code>, <code>ot_recognized_background_attachment</code>, <code>ot_recognized_background_position</code>, ' . __( 'and', 'option-tree' ) . ' <code>ot_type_background_size_choices</code>' ) . '</p>'; // phpcs:ignore |
123 echo '<p>' . __( 'The Category Select option type displays a list of category IDs. It allows the user to select only one category ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
129 |
124 |
130 echo '<h4>' . esc_html__( 'Border', 'option-tree' ) . ':</h4>'; |
125 echo '<h4>'. __( 'Checkbox', 'option-tree' ) . ':</h4>'; |
131 |
126 echo '<p>' . __( 'The Checkbox option type displays a group of choices. It allows the user to check multiple choices and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
132 /* translators: %1$s: pixel unit, %2$s: percentage unit, %3$s: em unit, %4$s: point unit, %5$s: filter name, %6$s: hidden, %7$s: dashed, %8$s: solid, %9$s: double, %10$s: groove, %11$s: ridge, %12$s: inset, %13$s: outset, %14$s: filter name */ |
127 |
133 $string = esc_html__( 'The Border option type is used to set width, unit, style, and color values. The text input excepts a numerical value and the unit select lets you choose the unit of measurement to add to that value. Currently the default units are %1$s, %2$s, %3$s, and %4$s. However, you can change them with the %5$s filter. The style select lets you choose the border style. The default styles are %6$s, %7$s, %8$s, %9$s, %10$s, %11$s, %12$s, and %13$s. However, you can change them with the %14$s filter. The colorpicker saves a hexadecimal color code.', 'option-tree' ); |
128 echo '<h4>'. __( 'Colorpicker', 'option-tree' ) . ':</h4>'; |
134 echo '<p>' . sprintf( $string, '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_recognized_border_unit_types</code>', '<code>hidden</code>', '<code>dashed</code>', '<code>solid</code>', '<code>double</code>', '<code>groove</code>', '<code>ridge</code>', '<code>inset</code>', '<code>outset</code>', '<code>ot_recognized_border_style_types</code>' ) . '</p>'; // phpcs:ignore |
129 echo '<p>' . __( 'The Colorpicker option type saves a hexadecimal color code for use in CSS. Use it to modify the color of something in your theme.', 'option-tree' ) . '</p>'; |
135 |
130 |
136 echo '<h4>' . esc_html__( 'Box Shadow', 'option-tree' ) . ':</h4>'; |
131 echo '<h4>'. __( 'Colorpicker Opacity', 'option-tree' ) . ':</h4>'; |
137 |
132 echo '<p>' . sprintf( __( 'The Colorpicker Opacity option type saves a hexadecimal color code with an opacity value from %s to %s in increments of %s. Though the value is saved as hexadecimal, if used within the CSS option type the color and opacity values will be converted into a valid RGBA CSS value.', 'option-tree' ), '<code>0</code>', '<code>1</code>', '<code>0.01</code>' ) . '</p>'; |
138 /* translators: %1$s: inset, %2$s: offset-x, %3$s: offset-y, %4$s: blur-radius, %5$s: spread-radius, %6$s: color */ |
133 |
139 $string = esc_html__( 'The Box Shadow option type is used to set %1$s, %2$s, %3$s, %4$s, %5$s, and %6$s values.', 'option-tree' ); |
134 echo '<h4>'. __( 'CSS', 'option-tree' ) . ':</h4>'; |
140 echo '<p>' . sprintf( $string, '<code>inset</code>', '<code>offset-x</code>', '<code>offset-y</code>', '<code>blur-radius</code>', '<code>spread-radius</code>', '<code>color</code>' ) . '</p>'; // phpcs:ignore |
135 echo '<p>' . sprintf( __( 'The CSS option type is a textarea that when used properly can add dynamic CSS to your theme from within OptionTree. Unfortunately, due server limitations you will need to create a file named %s at the root level of your theme and change permissions using %s so the server can write to the file. I have had the most success setting this single file to %s but feel free to play around with permissions until everything is working. A good starting point is %s. When the server can save to the file, CSS will automatically be updated when you save your Theme Options.', 'option-tree' ), '<code>dynamic.css</code>', '<code>chmod</code>', '<code>0777</code>', '<code>0666</code>' ) . '</p>'; |
141 |
136 |
142 echo '<h4>' . esc_html__( 'Category Checkbox', 'option-tree' ) . ':</h4>'; |
137 echo '<p class="aside">' . sprintf( __( 'This example assumes you have an option with the ID of %1$s. Which means this option will automatically insert the value of %1$s into the %2$s when the Theme Options are saved.', 'option-tree' ), '<code>demo_background</code>', '<code>dynamic.css</code>' ) . '</p>'; |
143 echo '<p>' . esc_html__( 'The Category Checkbox option type displays a list of category IDs. It allows the user to check multiple category IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
138 |
144 |
139 echo '<p>'. __( 'Input', 'option-tree' ) . ':</p>'; |
145 echo '<h4>' . esc_html__( 'Category Select', 'option-tree' ) . ':</h4>'; |
140 echo '<pre><code>body { |
146 echo '<p>' . esc_html__( 'The Category Select option type displays a list of category IDs. It allows the user to select only one category ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
|
147 |
|
148 echo '<h4>' . esc_html__( 'Checkbox', 'option-tree' ) . ':</h4>'; |
|
149 echo '<p>' . esc_html__( 'The Checkbox option type displays a group of choices. It allows the user to check multiple choices and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
|
150 |
|
151 echo '<h4>' . esc_html__( 'Colorpicker', 'option-tree' ) . ':</h4>'; |
|
152 echo '<p>' . esc_html__( 'The Colorpicker option type saves a hexadecimal color code for use in CSS. Use it to modify the color of something in your theme.', 'option-tree' ) . '</p>'; |
|
153 |
|
154 echo '<h4>' . esc_html__( 'Colorpicker Opacity', 'option-tree' ) . ':</h4>'; |
|
155 |
|
156 /* translators: %1$s: range minimum, %2$s: range maximum, %3$s: minimum increment */ |
|
157 $string = esc_html__( 'The Colorpicker Opacity option type saves a hexadecimal color code with an opacity value from %1$s to %2$s in increments of %3$s. Though the value is saved as hexadecimal, if used within the CSS option type the color and opacity values will be converted into a valid RGBA CSS value.', 'option-tree' ); |
|
158 echo '<p>' . sprintf( $string, '<code>0</code>', '<code>1</code>', '<code>0.01</code>' ) . '</p>'; // phpcs:ignore |
|
159 |
|
160 echo '<h4>' . esc_html__( 'CSS', 'option-tree' ) . ':</h4>'; |
|
161 |
|
162 /* translators: %1$s: file name, %2$s: command name, %3$s: permission mode, %4$s: permission mode */ |
|
163 $string = esc_html__( 'The CSS option type is a textarea that when used properly can add dynamic CSS to your theme from within OptionTree. Unfortunately, due server limitations you will need to create a file named %1$s at the root level of your theme and change permissions using %2$s so the server can write to the file. I have had the most success setting this single file to %3$s but feel free to play around with permissions until everything is working. A good starting point is %4$s. When the server can save to the file, CSS will automatically be updated when you save your Theme Options.', 'option-tree' ); |
|
164 echo '<p>' . sprintf( $string, '<code>dynamic.css</code>', '<code>chmod</code>', '<code>0777</code>', '<code>0666</code>' ) . '</p>'; // phpcs:ignore |
|
165 |
|
166 /* translators: option ID: pixel unit, %2$s: file name */ |
|
167 $string = esc_html__( 'This example assumes you have an option with the ID of %1$s. Which means this option will automatically insert the value of %1$s into the %2$s when the Theme Options are saved.', 'option-tree' ); |
|
168 echo '<p class="aside">' . sprintf( $string, '<code>demo_background</code>', '<code>dynamic.css</code>' ) . '</p>'; // phpcs:ignore |
|
169 |
|
170 echo '<p>' . esc_html__( 'Input', 'option-tree' ) . ':</p>'; |
|
171 echo '<pre><code>body { |
141 {{demo_background}} |
172 {{demo_background}} |
142 background-color: {{demo_background|background-color}}; |
173 background-color: {{demo_background|background-color}}; |
143 }</code></pre>'; |
174 }</code></pre>'; |
144 |
175 |
145 echo '<p>'. __( 'Output', 'option-tree' ) . ':</p>'; |
176 echo '<p>' . esc_html__( 'Output', 'option-tree' ) . ':</p>'; |
146 echo '<pre><code>/* BEGIN demo_background */ |
177 echo '<pre><code>/* BEGIN demo_background */ |
147 body { |
178 body { |
148 background: color image repeat attachment position; |
179 background: color image repeat attachment position; |
149 background-color: color; |
180 background-color: color; |
150 } |
181 } |
151 /* END demo_background */</code></pre>'; |
182 /* END demo_background */</code></pre>'; |
152 |
183 |
153 echo '<h4>'. __( 'Custom Post Type Checkbox', 'option-tree' ) . ':</h4>'; |
184 echo '<h4>' . esc_html__( 'Custom Post Type Checkbox', 'option-tree' ) . ':</h4>'; |
154 echo '<p>' . sprintf( __( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It allows the user to check multiple post IDs for use in a custom function or loop. Requires at least one valid %1$s in the %1$s field.', 'option-tree' ), '<code>post_type</code>' ) . '</p>'; |
185 |
155 |
186 /* translators: %1$s: post_type */ |
156 echo '<h4>'. __( 'Custom Post Type Select', 'option-tree' ) . ':</h4>'; |
187 $string = esc_html__( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It allows the user to check multiple post IDs for use in a custom function or loop. Requires at least one valid %1$s in the %1$s field.', 'option-tree' ); |
157 echo '<p>' . sprintf( __( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It will return a single post ID for use in a custom function or loop. Requires at least one valid %1$s in the %1$s field.', 'option-tree' ), '<code>post_type</code>' ) . '</p>'; |
188 echo '<p>' . sprintf( $string, '<code>post_type</code>' ) . '</p>'; // phpcs:ignore |
158 |
189 |
159 echo '<h4>'. __( 'Date Picker', 'option-tree' ) . ':</h4>'; |
190 echo '<h4>' . esc_html__( 'Custom Post Type Select', 'option-tree' ) . ':</h4>'; |
160 echo '<p>' . __( 'The Date Picker option type is tied to a standard form input field which displays a calendar pop-up that allow the user to pick any date when focus is given to the input field. The returned value is a date formatted string.', 'option-tree' ) . '</p>'; |
191 |
161 |
192 /* translators: %s: post_type */ |
162 echo '<h4>'. __( 'Date Time Picker', 'option-tree' ) . ':</h4>'; |
193 $string = esc_html__( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It will return a single post ID for use in a custom function or loop. Requires at least one valid %1$s in the %1$s field.', 'option-tree' ); |
163 echo '<p>' . __( 'The Date Time Picker option type is tied to a standard form input field which displays a calendar pop-up that allow the user to pick any date and time when focus is given to the input field. The returned value is a date and time formatted string.', 'option-tree' ) . '</p>'; |
194 echo '<p>' . sprintf( $string, '<code>post_type</code>' ) . '</p>'; // phpcs:ignore |
164 |
195 |
165 echo '<h4>'. __( 'Dimension', 'option-tree' ) . ':</h4>'; |
196 echo '<h4>' . esc_html__( 'Date Picker', 'option-tree' ) . ':</h4>'; |
166 echo '<p>' . sprintf( __( 'The Dimension option type is used to set width and height values. The text inputs except numerical values and the select lets you choose the unit of measurement to add to that value. Currently the default units are %s, %s, %s, and %s. However, you can change them with the %s filter.', 'option-tree' ), '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_recognized_dimension_unit_types</code>' ) . '</p>'; |
197 echo '<p>' . esc_html__( 'The Date Picker option type is tied to a standard form input field which displays a calendar pop-up that allow the user to pick any date when focus is given to the input field. The returned value is a date formatted string.', 'option-tree' ) . '</p>'; |
167 |
198 |
168 echo '<h4>'. __( 'Gallery', 'option-tree' ) . ':</h4>'; |
199 echo '<h4>' . esc_html__( 'Date Time Picker', 'option-tree' ) . ':</h4>'; |
169 echo '<p>' . __( 'The Gallery option type saves a comma separated list of image attachment IDs. You will need to create a front-end function to display the images in your theme.', 'option-tree' ) . '</p>'; |
200 echo '<p>' . esc_html__( 'The Date Time Picker option type is tied to a standard form input field which displays a calendar pop-up that allow the user to pick any date and time when focus is given to the input field. The returned value is a date and time formatted string.', 'option-tree' ) . '</p>'; |
170 |
201 |
171 echo '<h4>'. __( 'Google Fonts', 'option-tree' ) . ':</h4>'; |
202 echo '<h4>' . esc_html__( 'Dimension', 'option-tree' ) . ':</h4>'; |
172 echo '<p>' . sprintf( __( 'The Google Fonts option type will dynamically enqueue any number of Google Web Fonts into the document %1$s. As well, once the option has been saved each font family will automatically be inserted into the %2$s array for the Typography option type. You can further modify the font stack by using the %3$s filter, which is passed the %4$s, %5$s, and %6$s parameters. The %6$s parameter is being passed from %7$s, so it will be the ID of a Typography option type. This will allow you to add additional web safe fonts to individual font families on an as-need basis.', 'option-tree' ), '<code>HEAD</code>', '<code>font-family</code>', '<code>ot_google_font_stack</code>', '<code>$font_stack</code>', '<code>$family</code>', '<code>$field_id</code>', '<code>ot_recognized_font_families</code>' ) . '</p>'; |
203 |
173 |
204 /* translators: %1$s: pixel unit, %2$s: percentage unit, %3$s: em unit, %4$s: point unit, %5$s: filter name */ |
174 echo '<h4>'. __( 'JavaScript', 'option-tree' ) . ':</h4>'; |
205 $string = esc_html__( 'The Dimension option type is used to set width and height values. The text inputs except numerical values and the select lets you choose the unit of measurement to add to that value. Currently the default units are %1$s, %2$s, %3$s, and %4$s. However, you can change them with the %5$s filter.', 'option-tree' ); |
175 echo '<p>' . sprintf( __( 'The JavaScript option type is a textarea that uses the %s code editor to highlight your JavaScript and display errors as you type.', 'option-tree' ), '<code>ace.js</code>' ) . '</p>'; |
206 echo '<p>' . sprintf( $string, '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_recognized_dimension_unit_types</code>' ) . '</p>'; // phpcs:ignore |
176 |
207 |
177 echo '<h4>'. __( 'Link Color', 'option-tree' ) . ':</h4>'; |
208 echo '<h4>' . esc_html__( 'Gallery', 'option-tree' ) . ':</h4>'; |
178 echo '<p>' . __( 'The Link Color option type is used to set all link color states.', 'option-tree' ) . '</p>'; |
209 echo '<p>' . esc_html__( 'The Gallery option type saves a comma separated list of image attachment IDs. You will need to create a front-end function to display the images in your theme.', 'option-tree' ) . '</p>'; |
179 |
210 |
180 echo '<h4>'. __( 'List Item', 'option-tree' ) . ':</h4>'; |
211 echo '<h4>' . esc_html__( 'Google Fonts', 'option-tree' ) . ':</h4>'; |
181 echo '<p>' . __( 'The List Item option type replaced the Slider option type and allows for a great deal of customization. You can add settings to the List Item and those settings will be displayed to the user when they add a new List Item. Typical use is for creating sliding content or blocks of code for custom layouts.', 'option-tree' ) . '</p>'; |
212 |
182 |
213 /* translators: %1$s: HTML Document HEAD, %2$s: array key, %3$s: filter name, %4$s: parameter name, %5$s: parameter name, %6$s: parameter name, %7$s: function name*/ |
183 echo '<h4>'. __( 'Measurement', 'option-tree' ) . ':</h4>'; |
214 $string = esc_html__( 'The Google Fonts option type will dynamically enqueue any number of Google Web Fonts into the document %1$s. As well, once the option has been saved each font family will automatically be inserted into the %2$s array for the Typography option type. You can further modify the font stack by using the %3$s filter, which is passed the %4$s, %5$s, and %6$s parameters. The %6$s parameter is being passed from %7$s, so it will be the ID of a Typography option type. This will allow you to add additional web safe fonts to individual font families on an as-need basis.', 'option-tree' ); |
184 echo '<p>' . sprintf( __( 'The Measurement option type is a mix of input and select fields. The text input excepts a value and the select lets you choose the unit of measurement to add to that value. Currently the default units are %s, %s, %s, and %s. However, you can change them with the %s filter.', 'option-tree' ), '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_measurement_unit_types</code>' ) . '</p>'; |
215 echo '<p>' . sprintf( $string, '<code>HEAD</code>', '<code>font-family</code>', '<code>ot_google_font_stack</code>', '<code>$font_stack</code>', '<code>$family</code>', '<code>$field_id</code>', '<code>ot_recognized_font_families</code>' ) . '</p>'; // phpcs:ignore |
185 |
216 |
186 echo '<p>' . sprintf( __( 'Example filter to add new units to the Measurement option type. Added to %s.', 'option-tree' ), '<code>functions.php</code>' ) . '</p>'; |
217 echo '<h4>' . esc_html__( 'JavaScript', 'option-tree' ) . ':</h4>'; |
187 echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) { |
218 |
|
219 /* translators: %s: file name */ |
|
220 $string = esc_html__( 'The JavaScript option type is a textarea that uses the %s code editor to highlight your JavaScript and display errors as you type.', 'option-tree' ); |
|
221 echo '<p>' . sprintf( $string, '<code>ace.js</code>' ) . '</p>'; // phpcs:ignore |
|
222 |
|
223 echo '<h4>' . esc_html__( 'Link Color', 'option-tree' ) . ':</h4>'; |
|
224 echo '<p>' . esc_html__( 'The Link Color option type is used to set all link color states.', 'option-tree' ) . '</p>'; |
|
225 |
|
226 echo '<h4>' . esc_html__( 'List Item', 'option-tree' ) . ':</h4>'; |
|
227 echo '<p>' . esc_html__( 'The List Item option type replaced the Slider option type and allows for a great deal of customization. You can add settings to the List Item and those settings will be displayed to the user when they add a new List Item. Typical use is for creating sliding content or blocks of code for custom layouts.', 'option-tree' ) . '</p>'; |
|
228 |
|
229 echo '<h4>' . esc_html__( 'Measurement', 'option-tree' ) . ':</h4>'; |
|
230 |
|
231 /* translators: %1$s: pixel unit, %2$s: percentage unit, %3$s: em unit, %4$s: point unit, %5$s: filter name */ |
|
232 $string = esc_html__( 'The Measurement option type is a mix of input and select fields. The text input excepts a value and the select lets you choose the unit of measurement to add to that value. Currently the default units are %1$s, %2$s, %3$s, and %4$s. However, you can change them with the %5$s filter.', 'option-tree' ); |
|
233 echo '<p>' . sprintf( $string, '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_measurement_unit_types</code>' ) . '</p>'; // phpcs:ignore |
|
234 |
|
235 /* translators: %s: file name */ |
|
236 $string = esc_html__( 'Example filter to add new units to the Measurement option type. Added to %s.', 'option-tree' ); |
|
237 echo '<p>' . sprintf( $string, '<code>functions.php</code>' ) . '</p>'; // phpcs:ignore |
|
238 |
|
239 echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) { |
188 |
240 |
189 /* only run the filter on measurement with a field ID of my_measurement */ |
241 /* only run the filter on measurement with a field ID of my_measurement */ |
190 if ( $field_id == \'my_measurement\' ) { |
242 if ( $field_id == \'my_measurement\' ) { |
191 $array[\'in\'] = \'inches\'; |
243 $array[\'in\'] = \'inches\'; |
192 $array[\'ft\'] = \'feet\'; |
244 $array[\'ft\'] = \'feet\'; |
256 |
320 |
257 return $array; |
321 return $array; |
258 |
322 |
259 } |
323 } |
260 add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 2 );</code></pre>'; |
324 add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 2 );</code></pre>'; |
261 |
325 |
262 echo '<h4>'. __( 'Select', 'option-tree' ) . ':</h4>'; |
326 echo '<h4>' . esc_html__( 'Select', 'option-tree' ) . ':</h4>'; |
263 echo '<p>' . __( 'The Select option type is used to list anything you want that would be chosen from a select list.', 'option-tree' ) . '</p>'; |
327 echo '<p>' . esc_html__( 'The Select option type is used to list anything you want that would be chosen from a select list.', 'option-tree' ) . '</p>'; |
264 |
328 |
265 echo '<h4>'. __( 'Sidebar Select', 'option-tree' ) . ':</h4>'; |
329 echo '<h4>' . esc_html__( 'Sidebar Select', 'option-tree' ) . ':</h4>'; |
266 echo '<p>' . sprintf( __( 'This option type makes it possible for users to select a WordPress registered sidebar to use on a specific area. By using the two provided filters, %s, and %s we can be selective about which sidebars are available on a specific content area.', 'option-tree' ), '<code>ot_recognized_sidebars</code>', '<code>ot_recognized_sidebars_{$field_id}</code>' ) . '</p>'; |
330 |
267 echo '<p>' . sprintf( __( 'For example, if we create a WordPress theme that provides the ability to change the Blog Sidebar and we don\'t want to have the footer sidebars available on this area, we can unset those sidebars either manually or by using a regular expression if we have a common name like %s.', 'option-tree' ), '<code>footer-sidebar-$i</code>' ) . '</p>'; |
331 /* translators: %1$s: filter name, %2$s: dynamic filter name with field_id */ |
268 |
332 $string = esc_html__( 'This option type makes it possible for users to select a WordPress registered sidebar to use on a specific area. By using the two provided filters, %1$s, and %2$s we can be selective about which sidebars are available on a specific content area.', 'option-tree' ); |
269 echo '<h4>'. __( 'Slider', 'option-tree' ) . ':</h4>'; |
333 echo '<p>' . sprintf( $string, '<code>ot_recognized_sidebars</code>', '<code>ot_recognized_sidebars_{$field_id}</code>' ) . '</p>'; // phpcs:ignore |
270 echo '<p>' . __( 'The Slider option type is technically deprecated. Use the List Item option type instead, as it\'s infinitely more customizable. Typical use is for creating sliding image content.', 'option-tree' ) . '</p>'; |
334 |
271 |
335 /* translators: %s: dynamic sidebar name */ |
272 echo '<h4>'. __( 'Social Links', 'option-tree' ) . ':</h4>'; |
336 $string = esc_html__( 'For example, if we create a WordPress theme that provides the ability to change the Blog Sidebar and we don\'t want to have the footer sidebars available on this area, we can unset those sidebars either manually or by using a regular expression if we have a common name like %s.', 'option-tree' ); |
273 echo '<p>' . sprintf( __( 'The Social Links option type utilizes a drag & drop interface to create a list of social links. There are a few filters that make extending this option type easy. You can set the %s filter to %s and turn off loading default values. Use the %s filter to change the default values that are loaded. To filter the settings array use the %s filter.', 'option-tree' ), '<code>ot_type_social_links_load_defaults</code>', '<code>false</code>', '<code>ot_type_social_links_defaults</code>', '<code>ot_social_links_settings</code>' ) . '</p>'; |
337 echo '<p>' . sprintf( $string, '<code>footer-sidebar-$i</code>' ) . '</p>'; // phpcs:ignore |
274 |
338 |
275 echo '<h4>'. __( 'Spacing', 'option-tree' ) . ':</h4>'; |
339 echo '<h4>' . esc_html__( 'Slider', 'option-tree' ) . ':</h4>'; |
276 echo '<p>' . sprintf( __( 'The Spacing option type is used to set spacing values such as padding or margin in the form of top, right, bottom, and left. The text inputs except numerical values and the select lets you choose the unit of measurement to add to that value. Currently the default units are %s, %s, %s, and %s. However, you can change them with the %s filter.', 'option-tree' ), '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_recognized_spacing_unit_types</code>' ) . '</p>'; |
340 echo '<p>' . esc_html__( 'The Slider option type is technically deprecated. Use the List Item option type instead, as it\'s infinitely more customizable. Typical use is for creating sliding image content.', 'option-tree' ) . '</p>'; |
277 |
341 |
278 echo '<h4>'. __( 'Tab', 'option-tree' ) . ':</h4>'; |
342 echo '<h4>' . esc_html__( 'Social Links', 'option-tree' ) . ':</h4>'; |
279 echo '<p>' . __( 'The Tab option type will break a section or metabox into tabbed content.', 'option-tree' ) . '</p>'; |
343 |
280 |
344 /* translators: %1$s: filter name, %2$s: boolean value, %3$s: filter name, %4$s: filter name */ |
281 echo '<h4>'. __( 'Tag Checkbox', 'option-tree' ) . ':</h4>'; |
345 $string = esc_html__( 'The Social Links option type utilizes a drag & drop interface to create a list of social links. There are a few filters that make extending this option type easy. You can set the %1$s filter to %2$s and turn off loading default values. Use the %3$s filter to change the default values that are loaded. To filter the settings array use the %4$s filter.', 'option-tree' ); |
282 echo '<p>' . __( 'The Tag Checkbox option type displays a list of tag IDs. It allows the user to check multiple tag IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
346 echo '<p>' . sprintf( $string, '<code>ot_type_social_links_load_defaults</code>', '<code>false</code>', '<code>ot_type_social_links_defaults</code>', '<code>ot_social_links_settings</code>' ) . '</p>'; // phpcs:ignore |
283 |
347 |
284 echo '<h4>'. __( 'Tag Select', 'option-tree' ) . ':</h4>'; |
348 echo '<h4>' . esc_html__( 'Spacing', 'option-tree' ) . ':</h4>'; |
285 echo '<p>' . __( 'The Tag Select option type displays a list of tag IDs. It allows the user to select only one tag ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
349 |
286 |
350 /* translators: %1$s: pixel unit, %2$s: percentage unit, %3$s: em unit, %4$s: point unit, %5$s: filter name */ |
287 echo '<h4>'. __( 'Taxonomy Checkbox', 'option-tree' ) . ':</h4>'; |
351 $string = esc_html__( 'The Spacing option type is used to set spacing values such as padding or margin in the form of top, right, bottom, and left. The text inputs except numerical values and the select lets you choose the unit of measurement to add to that value. Currently the default units are %1$s, %2$s, %3$s, and %4$s. However, you can change them with the %5$s filter.', 'option-tree' ); |
288 echo '<p>' . __( 'The Taxonomy Checkbox option type displays a list of taxonomy IDs. It allows the user to check multiple taxonomy IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
352 echo '<p>' . sprintf( $string, '<code>px</code>', '<code>%</code>', '<code>em</code>', '<code>pt</code>', '<code>ot_recognized_spacing_unit_types</code>' ) . '</p>'; // phpcs:ignore |
289 |
353 |
290 echo '<h4>'. __( 'Taxonomy Select', 'option-tree' ) . ':</h4>'; |
354 echo '<h4>' . esc_html__( 'Tab', 'option-tree' ) . ':</h4>'; |
291 echo '<p>' . __( 'The Taxonomy Select option type displays a list of taxonomy IDs. It allows the user to select only one taxonomy ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
355 echo '<p>' . esc_html__( 'The Tab option type will break a section or metabox into tabbed content.', 'option-tree' ) . '</p>'; |
292 |
356 |
293 echo '<h4>'. __( 'Text', 'option-tree' ) . ':</h4>'; |
357 echo '<h4>' . esc_html__( 'Tag Checkbox', 'option-tree' ) . ':</h4>'; |
294 echo '<p>' . __( 'The Text option type is used to save string values. For example, any optional or required text that is of reasonably short character length.', 'option-tree' ) . '</p>'; |
358 echo '<p>' . esc_html__( 'The Tag Checkbox option type displays a list of tag IDs. It allows the user to check multiple tag IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
295 |
359 |
296 echo '<h4>'. __( 'Textarea', 'option-tree' ) . ':</h4>'; |
360 echo '<h4>' . esc_html__( 'Tag Select', 'option-tree' ) . ':</h4>'; |
297 echo '<p>' . sprintf( __( 'The Textarea option type is a large string value used for custom code or text in the theme and has a WYSIWYG editor that can be filtered to change the how it is displayed. For example, you can filter %s, %s, %s, and %s.', 'option-tree' ), '<code>wpautop</code>', '<code>media_buttons</code>', '<code>tinymce</code>', '<code>quicktags</code>' ) . '</p>'; |
361 echo '<p>' . esc_html__( 'The Tag Select option type displays a list of tag IDs. It allows the user to select only one tag ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
298 |
362 |
299 echo '<p class="aside">' . __( 'Example filters to alter the Textarea option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>'; |
363 echo '<h4>' . esc_html__( 'Taxonomy Checkbox', 'option-tree' ) . ':</h4>'; |
300 |
364 echo '<p>' . esc_html__( 'The Taxonomy Checkbox option type displays a list of taxonomy IDs. It allows the user to check multiple taxonomy IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
301 echo '<p>' . __( 'This example keeps WordPress from executing the <code>wpautop</code> filter on the line breaks. The default is <code>true</code> which means it wraps line breaks with an HTML <code>p</code> tag.', 'option-tree' ) . '</p>'; |
365 |
302 echo '<pre><code>function filter_textarea_wpautop( $content, $field_id ) { |
366 echo '<h4>' . esc_html__( 'Taxonomy Select', 'option-tree' ) . ':</h4>'; |
|
367 echo '<p>' . esc_html__( 'The Taxonomy Select option type displays a list of taxonomy IDs. It allows the user to select only one taxonomy ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>'; |
|
368 |
|
369 echo '<h4>' . esc_html__( 'Text', 'option-tree' ) . ':</h4>'; |
|
370 echo '<p>' . esc_html__( 'The Text option type is used to save string values. For example, any optional or required text that is of reasonably short character length.', 'option-tree' ) . '</p>'; |
|
371 |
|
372 echo '<h4>' . esc_html__( 'Textarea', 'option-tree' ) . ':</h4>'; |
|
373 |
|
374 /* translators: %1$s: filter name, %2$s: filter name, %3$s: filter name, %4$s: filter name */ |
|
375 $string = esc_html__( 'The Textarea option type is a large string value used for custom code or text in the theme and has a WYSIWYG editor that can be filtered to change the how it is displayed. For example, you can filter %1$s, %2$s, %3$s, and %4$s.', 'option-tree' ); |
|
376 echo '<p>' . sprintf( $string, '<code>wpautop</code>', '<code>media_buttons</code>', '<code>tinymce</code>', '<code>quicktags</code>' ) . '</p>'; // phpcs:ignore |
|
377 |
|
378 /* translators: %s: file name */ |
|
379 $string = esc_html__( 'Example filters to alter the Textarea option type. Added to %s.', 'option-tree' ); |
|
380 echo '<p class="aside">' . sprintf( $string, '<code>functions.php</code>' ) . '</p>'; // phpcs:ignore |
|
381 |
|
382 /* translators: %1$s: filter name, %2$s: boolean value, %3$s: paragraph tag */ |
|
383 $string = esc_html__( 'This example keeps WordPress from executing the %1$s filter on the line breaks. The default is %2$s which means it wraps line breaks with an HTML %3$s tag.', 'option-tree' ); |
|
384 echo '<p>' . sprintf( $string, '<code>wpautop</code>', '<code>true</code>', '<code>p</code>' ) . '</p>'; // phpcs:ignore |
|
385 |
|
386 echo '<pre><code>function filter_textarea_wpautop( $content, $field_id ) { |
303 |
387 |
304 /* only run the filter on the textarea with a field ID of my_textarea */ |
388 /* only run the filter on the textarea with a field ID of my_textarea */ |
305 if ( $field_id == \'my_textarea\' ) { |
389 if ( $field_id == \'my_textarea\' ) { |
306 return false; |
390 return false; |
307 } |
391 } |
392 return $array; |
489 return $array; |
393 |
490 |
394 } |
491 } |
395 add_filter( \'ot_recognized_font_families\', \'filter_ot_recognized_font_families\', 10, 2 );</code></pre>'; |
492 add_filter( \'ot_recognized_font_families\', \'filter_ot_recognized_font_families\', 10, 2 );</code></pre>'; |
396 |
493 |
397 echo '<h4>'. __( 'Upload', 'option-tree' ) . ':</h4>'; |
494 echo '<h4>' . esc_html__( 'Upload', 'option-tree' ) . ':</h4>'; |
398 echo '<p>' . sprintf( __( 'The Upload option type is used to upload any WordPress supported media. After uploading, users are required to press the "%s" button in order to populate the input with the URI of that media. There is one caveat of this feature. If you import the theme options and have uploaded media on one site the old URI will not reflect the URI of your new site. You will have to re-upload or %s any media to your new server and change the URIs if necessary.', 'option-tree' ), apply_filters( 'ot_upload_text', __( 'Send to OptionTree', 'option-tree' ) ), 'FTP' ) . '</p>'; |
495 |
399 |
496 /* translators: %1$s: button text, %2$s: the FTP protocol */ |
400 echo '</div>'; |
497 $string = esc_html__( 'The Upload option type is used to upload any WordPress supported media. After uploading, users are required to press the "%1$s" button in order to populate the input with the URI of that media. There is one caveat of this feature. If you import the theme options and have uploaded media on one site the old URI will not reflect the URI of your new site. You will have to re-upload or %2$s any media to your new server and change the URIs if necessary.', 'option-tree' ); |
401 |
498 echo '<p>' . sprintf( $string, esc_html( apply_filters( 'ot_upload_text', __( 'Send to OptionTree', 'option-tree' ) ) ), 'FTP' ) . '</p>'; // phpcs:ignore |
402 echo '</div>'; |
499 |
403 |
500 echo '</div>'; |
404 } |
501 |
405 |
502 echo '</div>'; |
406 } |
503 } |
407 |
504 } |
408 /** |
505 |
409 * ot_get_option() option type. |
|
410 * |
|
411 * This is a callback function to display text about ot_get_option(). |
|
412 * |
|
413 * @return string |
|
414 * |
|
415 * @access public |
|
416 * @since 2.0 |
|
417 */ |
|
418 if ( ! function_exists( 'ot_type_ot_get_option' ) ) { |
506 if ( ! function_exists( 'ot_type_ot_get_option' ) ) { |
419 |
507 |
420 function ot_type_ot_get_option() { |
508 /** |
421 |
509 * The ot_get_option() option type. |
422 /* format setting outer wrapper */ |
510 * |
423 echo '<div class="format-setting type-textblock wide-desc">'; |
511 * This is a callback function to display text about ot_get_option(). |
424 |
512 * |
425 /* description */ |
513 * @access public |
426 echo '<div class="description">'; |
514 * @since 2.0 |
427 |
515 */ |
428 echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>'; |
516 function ot_type_ot_get_option() { |
429 |
517 |
430 echo '<p>' . __( 'This function returns a value from the "option_tree" array of saved values or the default value supplied. The returned value would be mixed. Meaning it could be a string, integer, boolean, or array.', 'option-tree' ) . '</p>'; |
518 // Format setting outer wrapper. |
431 |
519 echo '<div class="format-setting type-textblock wide-desc">'; |
432 echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>'; |
520 |
433 |
521 // Description. |
434 echo '<p><code><?php ot_get_option( $option_id, $default ); ?></code></p>'; |
522 echo '<div class="description">'; |
435 |
523 |
436 echo '<h4>' . __( 'Parameters', 'option-tree' ) . ':</h4>'; |
524 echo '<h4>' . esc_html__( 'Description', 'option-tree' ) . ':</h4>'; |
437 |
525 |
438 echo '<code>$option_id</code>'; |
526 echo '<p>' . esc_html__( 'This function returns a value from the "option_tree" array of saved values or the default value supplied. The returned value would be mixed. Meaning it could be a string, integer, boolean, or array.', 'option-tree' ) . '</p>'; |
439 |
527 |
440 echo '<p>(<em>' . __( 'string', 'option-tree' ) . '</em>) (<em>' . __( 'required', 'option-tree' ) . '</em>) ' . __( 'Enter the options unique identifier.', 'option-tree' ) . '<br />' . __( 'Default:', 'option-tree' ) . ' <em>' . __( 'None', 'option-tree' ) . '</em></p>'; |
528 echo '<h4>' . esc_html__( 'Usage', 'option-tree' ) . ':</h4>'; |
441 |
529 |
442 echo '<code>$default</code>'; |
530 echo '<p><code><?php ot_get_option( $option_id, $default ); ?></code></p>'; |
443 |
531 |
444 echo '<p>(<em>' . __( 'string', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Enter a default return value. This is just incase the request returns null.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': <em>' . __( 'None', 'option-tree' ) . '</em></p>'; |
532 echo '<h4>' . esc_html__( 'Parameters', 'option-tree' ) . ':</h4>'; |
445 |
533 |
446 echo '</div>'; |
534 echo '<code>$option_id</code>'; |
447 |
535 |
448 echo '</div>'; |
536 echo '<p>(<em>' . esc_html__( 'string', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'required', 'option-tree' ) . '</em>) ' . esc_html__( 'Enter the options unique identifier.', 'option-tree' ) . '<br />' . esc_html__( 'Default:', 'option-tree' ) . ' <em>' . esc_html__( 'None', 'option-tree' ) . '</em></p>'; |
449 |
537 |
450 } |
538 echo '<code>$default</code>'; |
451 |
539 |
452 } |
540 echo '<p>(<em>' . esc_html__( 'string', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'optional', 'option-tree' ) . '</em>) ' . esc_html__( 'Enter a default return value. This is just incase the request returns null.', 'option-tree' ) . '<br />' . esc_html__( 'Default', 'option-tree' ) . ': <em>' . esc_html__( 'None', 'option-tree' ) . '</em></p>'; |
453 |
541 |
454 /** |
542 echo '</div>'; |
455 * get_option_tree() option type. |
543 |
456 * |
544 echo '</div>'; |
457 * This is a callback function to display text about get_option_tree(). |
545 } |
458 * |
546 } |
459 * @return string |
547 |
460 * |
|
461 * @access public |
|
462 * @since 2.0 |
|
463 */ |
|
464 if ( ! function_exists( 'ot_type_get_option_tree' ) ) { |
548 if ( ! function_exists( 'ot_type_get_option_tree' ) ) { |
465 |
549 |
466 function ot_type_get_option_tree() { |
550 /** |
467 |
551 * The get_option_tree() option type. |
468 /* format setting outer wrapper */ |
552 * |
469 echo '<div class="format-setting type-textblock wide-desc">'; |
553 * This is a callback function to display text about get_option_tree(). |
470 |
554 * |
471 /* description */ |
555 * @access public |
472 echo '<div class="description">'; |
556 * @since 2.0 |
473 |
557 */ |
474 echo '<p class="deprecated">' . __( 'This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement.', 'option-tree' ) . '</p>'; |
558 function ot_type_get_option_tree() { |
475 |
559 |
476 echo '<p>' . __( 'Use', 'option-tree' ) . '<code>ot_get_option()</code>' . __( 'instead', 'option-tree' ) . '.</p>'; |
560 // Format setting outer wrapper. |
477 |
561 echo '<div class="format-setting type-textblock wide-desc">'; |
478 echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>'; |
562 |
479 |
563 // Description. |
480 echo '<p>' . __( 'This function returns, or echos if asked, a value from the "option_tree" array of saved values.', 'option-tree' ) . '</p>'; |
564 echo '<div class="description">'; |
481 |
565 |
482 echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>'; |
566 echo '<p class="deprecated">' . esc_html__( 'This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement.', 'option-tree' ) . '</p>'; |
483 |
567 |
484 echo '<p><code><?php get_option_tree( $item_id, $options, $echo, $is_array, $offset ); ?></code></p>'; |
568 echo '<p>' . esc_html__( 'Use', 'option-tree' ) . '<code>ot_get_option()</code>' . esc_html__( 'instead', 'option-tree' ) . '.</p>'; |
485 |
569 |
486 echo '<h4>' . __( 'Parameters', 'option-tree' ) . ':</h4>'; |
570 echo '<h4>' . esc_html__( 'Description', 'option-tree' ) . ':</h4>'; |
487 |
571 |
488 echo '<code>$item_id</code>'; |
572 echo '<p>' . esc_html__( 'This function returns, or echos if asked, a value from the "option_tree" array of saved values.', 'option-tree' ) . '</p>'; |
489 |
573 |
490 echo '<p>(<em>' . __( 'string', 'option-tree' ) . '</em>) (<em>' . __( 'required', 'option-tree' ) . '</em>) ' . __( 'Enter a unique Option Key to get a returned value or array.', 'option-tree' ) . '<br />' . __( 'Default:', 'option-tree' ) . ' <em>' . __( 'None', 'option-tree' ) . '</em></p>'; |
574 echo '<h4>' . esc_html__( 'Usage', 'option-tree' ) . ':</h4>'; |
491 |
575 |
492 echo '<code>$options</code>'; |
576 echo '<p><code><?php get_option_tree( $item_id, $options, $echo, $is_array, $offset ); ?></code></p>'; |
493 |
577 |
494 echo '<p>(<em>' . __( 'array', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Used to cut down on database queries in template files.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': <em>' . __( 'None', 'option-tree' ) . '</em></p>'; |
578 echo '<h4>' . esc_html__( 'Parameters', 'option-tree' ) . ':</h4>'; |
495 |
579 |
496 echo '<code>$echo</code>'; |
580 echo '<code>$item_id</code>'; |
497 |
581 |
498 echo '<p>(<em>' . __( 'boolean', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Echo the output.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': FALSE</p>'; |
582 echo '<p>(<em>' . esc_html__( 'string', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'required', 'option-tree' ) . '</em>) ' . esc_html__( 'Enter a unique Option Key to get a returned value or array.', 'option-tree' ) . '<br />' . esc_html__( 'Default:', 'option-tree' ) . ' <em>' . esc_html__( 'None', 'option-tree' ) . '</em></p>'; |
499 |
583 |
500 echo '<code>$is_array</code>'; |
584 echo '<code>$options</code>'; |
501 |
585 |
502 echo '<p>(<em>' . __( 'boolean', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Used to indicate the $item_id is an array of values.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': FALSE</p>'; |
586 echo '<p>(<em>' . esc_html__( 'array', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'optional', 'option-tree' ) . '</em>) ' . esc_html__( 'Used to cut down on database queries in template files.', 'option-tree' ) . '<br />' . esc_html__( 'Default', 'option-tree' ) . ': <em>' . esc_html__( 'None', 'option-tree' ) . '</em></p>'; |
503 |
587 |
504 echo '<code>$offset</code>'; |
588 echo '<code>$echo</code>'; |
505 |
589 |
506 echo '<p>(<em>' . __( 'integer', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Numeric offset key for the $item_id array, -1 will return all values (an array starts at 0).', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': -1</p>'; |
590 echo '<p>(<em>' . esc_html__( 'boolean', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'optional', 'option-tree' ) . '</em>) ' . esc_html__( 'Echo the output.', 'option-tree' ) . '<br />' . esc_html__( 'Default', 'option-tree' ) . ': FALSE</p>'; |
507 |
591 |
508 echo '</div>'; |
592 echo '<code>$is_array</code>'; |
509 |
593 |
510 echo '</div>'; |
594 echo '<p>(<em>' . esc_html__( 'boolean', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'optional', 'option-tree' ) . '</em>) ' . esc_html__( 'Used to indicate the $item_id is an array of values.', 'option-tree' ) . '<br />' . esc_html__( 'Default', 'option-tree' ) . ': FALSE</p>'; |
511 |
595 |
512 } |
596 echo '<code>$offset</code>'; |
513 |
597 |
514 } |
598 echo '<p>(<em>' . esc_html__( 'integer', 'option-tree' ) . '</em>) (<em>' . esc_html__( 'optional', 'option-tree' ) . '</em>) ' . esc_html__( 'Numeric offset key for the $item_id array, -1 will return all values (an array starts at 0).', 'option-tree' ) . '<br />' . esc_html__( 'Default', 'option-tree' ) . ': -1</p>'; |
515 |
599 |
516 /** |
600 echo '</div>'; |
517 * Examples option type. |
601 |
518 * |
602 echo '</div>'; |
519 * @return string |
603 } |
520 * |
604 } |
521 * @access public |
605 |
522 * @since 2.0 |
|
523 */ |
|
524 if ( ! function_exists( 'ot_type_examples' ) ) { |
606 if ( ! function_exists( 'ot_type_examples' ) ) { |
525 |
607 |
526 function ot_type_examples() { |
608 /** |
527 |
609 * Examples option type. |
528 /* format setting outer wrapper */ |
610 * |
529 echo '<div class="format-setting type-textblock wide-desc">'; |
611 * @access public |
530 |
612 * @since 2.0 |
531 /* description */ |
613 */ |
532 echo '<div class="description">'; |
614 function ot_type_examples() { |
533 |
615 |
534 echo '<p class="aside">' . __( 'If you\'re using the plugin version of OptionTree it is highly recommended to include a <code>function_exists</code> check in your code, as described in the examples below. If you\'ve integrated OptionTree directly into your themes root directory, you will <strong>not</strong> need to wrap your code with <code>function_exists</code>, as you\'re guaranteed to have the <code>ot_get_option()</code> function available.', 'option-tree' ) . '</p>'; |
616 // Format setting outer wrapper. |
535 |
617 echo '<div class="format-setting type-textblock wide-desc">'; |
536 echo '<h4>' . __( 'String Examples', 'option-tree' ) . ':</h4>'; |
618 |
537 |
619 // Description. |
538 echo '<p>' . __( 'Returns the value of <code>test_input</code>.', 'option-tree' ) . '</p>'; |
620 echo '<div class="description">'; |
539 |
621 |
540 echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) { |
622 /* translators: %1$s: function name, %2$s: emphasis on not, %3$s: function name, %4$s: function name */ |
|
623 $string = esc_html__( 'If you\'re using the plugin version of OptionTree it is highly recommended to include a %1$s check in your code, as described in the examples below. If you\'ve integrated OptionTree directly into your themes root directory, you will %2$s need to wrap your code with %3$s, as you\'re guaranteed to have the %4$s function available.', 'option-tree' ); |
|
624 echo '<p class="aside">' . sprintf( $string, '<code>function_exists</code>', '<strong>' . esc_html__( 'not', 'option-tree' ) . '</strong>', '<code>function_exists</code>', '<code>ot_get_option()</code>' ) . '</p>'; // phpcs:ignore |
|
625 |
|
626 echo '<h4>' . esc_html__( 'String Examples', 'option-tree' ) . ':</h4>'; |
|
627 |
|
628 /* translators: %s: option id */ |
|
629 $string = esc_html__( 'Returns the value of %s.', 'option-tree' ); |
|
630 echo '<p>' . sprintf( $string, '<code>test_input</code>' ) . '</p>'; // phpcs:ignore |
|
631 |
|
632 echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) { |
541 $test_input = ot_get_option( \'test_input\' ); |
633 $test_input = ot_get_option( \'test_input\' ); |
542 }</code></pre>'; |
634 }</code></pre>'; |
543 |
635 |
544 echo '<p>' . __( 'Returns the value of <code>test_input</code>, but also has a default value if it returns empty.', 'option-tree' ) . '</p>'; |
636 /* translators: %s: option id */ |
545 |
637 $string = esc_html__( 'Returns the value of %s, but also has a default value if it returns empty.', 'option-tree' ); |
546 echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) { |
638 echo '<p>' . sprintf( $string, '<code>test_input</code>' ) . '</p>'; // phpcs:ignore |
|
639 |
|
640 echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) { |
547 $test_input = ot_get_option( \'test_input\', \'default input value goes here.\' ); |
641 $test_input = ot_get_option( \'test_input\', \'default input value goes here.\' ); |
548 }</code></pre>'; |
642 }</code></pre>'; |
549 |
643 |
550 echo '<h4>' . __( 'Array Examples', 'option-tree' ) . ':</h4>'; |
644 echo '<h4>' . esc_html__( 'Array Examples', 'option-tree' ) . ':</h4>'; |
551 |
645 |
552 echo '<p>' . __( 'Assigns the value of <code>navigation_ids</code> to the variable <code>$ids</code>. It then echos an unordered list of links (navigation) using <code>wp_list_pages()</code>.', 'option-tree' ) . '</p>'; |
646 /* translators: %1$s: option id, %2$s: variable name, %3$s: function name */ |
553 |
647 $string = esc_html__( 'Assigns the value of %1$s to the variable %2$s. It then echos an unordered list of links (navigation) using %3$s.', 'option-tree' ); |
554 echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) { |
648 echo '<p>' . sprintf( $string, '<code>navigation_ids</code>', '<code>$ids</code>', '<code>wp_list_pages()</code>' ) . '</p>'; // phpcs:ignore |
|
649 |
|
650 echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) { |
555 /* get an array of page id\'s */ |
651 /* get an array of page id\'s */ |
556 $ids = ot_get_option( \'navigation_ids\', array() ); |
652 $ids = ot_get_option( \'navigation_ids\', array() ); |
557 |
653 |
558 /* echo custom navigation using wp_list_pages() */ |
654 /* echo custom navigation using wp_list_pages() */ |
559 if ( ! empty( $ids ) ) |
655 if ( ! empty( $ids ) ) |
611 </li>\'; |
709 </li>\'; |
612 } |
710 } |
613 } |
711 } |
614 |
712 |
615 }</code></pre>'; |
713 }</code></pre>'; |
616 |
714 |
617 echo '</div>'; |
715 echo '</div>'; |
618 |
716 |
619 echo '</div>'; |
717 echo '</div>'; |
620 |
718 } |
621 } |
719 } |
622 |
|
623 } |
|
624 |
|
625 /** |
|
626 * Layouts Overview option type. |
|
627 * |
|
628 * @return string |
|
629 * |
|
630 * @access public |
|
631 * @since 2.0 |
|
632 */ |
|
633 if ( ! function_exists( 'ot_type_layouts_overview' ) ) { |
720 if ( ! function_exists( 'ot_type_layouts_overview' ) ) { |
634 |
721 |
635 function ot_type_layouts_overview() { |
722 /** |
636 |
723 * Layouts Overview option type. |
637 /* format setting outer wrapper */ |
724 * |
638 echo '<div class="format-setting type-textblock wide-desc">'; |
725 * @access public |
639 |
726 * @since 2.0 |
640 /* description */ |
727 */ |
641 echo '<div class="description">'; |
728 function ot_type_layouts_overview() { |
642 |
729 |
643 echo '<h4>'. __( 'It\'s Super Simple', 'option-tree' ) . '</h4>'; |
730 // Format setting outer wrapper. |
644 |
731 echo '<div class="format-setting type-textblock wide-desc">'; |
645 echo '<p>' . __( 'Layouts make your theme awesome! With theme options data that you can save/import/export you can package themes with different color variations, or make it easy to do A/B testing on text and so much more. Basically, you save a snapshot of your data as a layout.', 'option-tree' ) . '</p>'; |
732 |
646 |
733 // Description. |
647 echo '<p>' . __( 'Once you have created all your different layouts, or theme variations, you can save them to a separate text file for repackaging with your theme. Alternatively, you could just make different variations for yourself and change your theme with the click of a button, all without deleting your previous options data.', 'option-tree' ) . '</p>'; |
734 echo '<div class="description">'; |
648 |
735 |
649 echo '<p class="aside">' . __( ' Adding a layout is ridiculously easy, follow these steps and you\'ll be on your way to having a WordPress super theme.', 'option-tree' ) . '</p>'; |
736 echo '<h4>' . esc_html__( 'It\'s Super Simple', 'option-tree' ) . '</h4>'; |
650 |
737 |
651 echo '<h4>' . __( 'For Developers', 'option-tree' ) . ':</h4>'; |
738 echo '<p>' . esc_html__( 'Layouts make your theme awesome! With theme options data that you can save/import/export you can package themes with different color variations, or make it easy to do A/B testing on text and so much more. Basically, you save a snapshot of your data as a layout.', 'option-tree' ) . '</p>'; |
652 |
739 |
653 echo '<h5>' . __( 'Creating a Layout', 'option-tree' ) . ':</h5>'; |
740 echo '<p>' . esc_html__( 'Once you have created all your different layouts, or theme variations, you can save them to a separate text file for repackaging with your theme. Alternatively, you could just make different variations for yourself and change your theme with the click of a button, all without deleting your previous options data.', 'option-tree' ) . '</p>'; |
654 echo '<ul class="docs-ul">'; |
741 |
655 echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>'; |
742 echo '<p class="aside">' . esc_html__( ' Adding a layout is ridiculously easy, follow these steps and you\'ll be on your way to having a WordPress super theme.', 'option-tree' ) . '</p>'; |
656 echo '<li>' . __( 'Enter a name for your layout in the text field and hit "Save Layouts", you\'ve created your first layout.', 'option-tree' ) . '</li>'; |
743 |
657 echo '<li>' . __( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>'; |
744 echo '<h4>' . esc_html__( 'For Developers', 'option-tree' ) . ':</h4>'; |
658 echo '</ul>'; |
745 |
659 |
746 echo '<h5>' . esc_html__( 'Creating a Layout', 'option-tree' ) . ':</h5>'; |
660 echo '<h5>' . __( 'Activating a Layout', 'option-tree' ) . ':</h5>'; |
747 echo '<ul class="docs-ul">'; |
661 echo '<ul class="docs-ul">'; |
748 |
662 echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>'; |
749 /* translators: %s: visual path to the page */ |
663 echo '<li>' . __( 'Click on the activate layout button in the actions list.', 'option-tree' ) . '</li>'; |
750 $string = esc_html__( 'Go to the %s tab.', 'option-tree' ); |
664 echo '</ul>'; |
751 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Settings->Layouts', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
665 |
752 echo '<li>' . esc_html__( 'Enter a name for your layout in the text field and hit "Save Layouts", you\'ve created your first layout.', 'option-tree' ) . '</li>'; |
666 echo '<h5>' . __( 'Deleting a Layout', 'option-tree' ) . ':</h5>'; |
753 echo '<li>' . esc_html__( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>'; |
667 echo '<ul class="docs-ul">'; |
754 echo '</ul>'; |
668 echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>'; |
755 |
669 echo '<li>' . __( 'Click on the delete layout button in the actions list.', 'option-tree' ) . '</li>'; |
756 echo '<h5>' . esc_html__( 'Activating a Layout', 'option-tree' ) . ':</h5>'; |
670 echo '</ul>'; |
757 echo '<ul class="docs-ul">'; |
671 |
758 |
672 echo '<h5>' . __( 'Edit Layout Data', 'option-tree' ) . ':</h5>'; |
759 /* translators: %s: visual path to the page */ |
673 echo '<ul class="docs-ul">'; |
760 $string = esc_html__( 'Go to the %s tab.', 'option-tree' ); |
674 echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>'; |
761 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Settings->Layouts', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
675 echo '<li>' . __( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>'; |
762 echo '<li>' . esc_html__( 'Click on the activate layout button in the actions list.', 'option-tree' ) . '</li>'; |
676 echo '<li>' . __( 'Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.', 'option-tree' ) . '</li>'; |
763 echo '</ul>'; |
677 echo '<li>' . __( 'If you want to edit a new layout, first create it then save your theme options.', 'option-tree' ) . '</li>'; |
764 |
678 echo '</ul>'; |
765 echo '<h5>' . esc_html__( 'Deleting a Layout', 'option-tree' ) . ':</h5>'; |
679 |
766 echo '<ul class="docs-ul">'; |
680 echo '<h4>' . __( 'End-Users Mode', 'option-tree' ) . ':</h4>'; |
767 |
681 |
768 /* translators: %s: visual path to the page */ |
682 echo '<h5>' . __( 'Creating a Layout', 'option-tree' ) . ':</h5>'; |
769 $string = esc_html__( 'Go to the %s tab.', 'option-tree' ); |
683 echo '<ul class="docs-ul">'; |
770 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Settings->Layouts', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
684 echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>'; |
771 echo '<li>' . esc_html__( 'Click on the delete layout button in the actions list.', 'option-tree' ) . '</li>'; |
685 echo '<li>' . __( 'Enter a name for your layout in the text field and hit "New Layout", you\'ve created your first layout.', 'option-tree' ) . '</li>'; |
772 echo '</ul>'; |
686 echo '<li>' . __( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>'; |
773 |
687 echo '</ul>'; |
774 echo '<h5>' . esc_html__( 'Edit Layout Data', 'option-tree' ) . ':</h5>'; |
688 |
775 echo '<ul class="docs-ul">'; |
689 echo '<h5>' . __( 'Activating a Layout', 'option-tree' ) . ':</h5>'; |
776 |
690 echo '<ul class="docs-ul">'; |
777 /* translators: %s: visual path to the page */ |
691 echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>'; |
778 $string = esc_html__( 'Go to the %s page.', 'option-tree' ); |
692 echo '<li>' . __( 'Choose a layout from the select list and click the "Activate Layout" button.', 'option-tree' ) . '</li>'; |
779 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'Appearance->Theme Options', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
693 echo '</ul>'; |
780 echo '<li>' . esc_html__( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>'; |
694 |
781 echo '<li>' . esc_html__( 'Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.', 'option-tree' ) . '</li>'; |
695 echo '<h5>' . __( 'Deleting a Layout', 'option-tree' ) . ':</h5>'; |
782 echo '<li>' . esc_html__( 'If you want to edit a new layout, first create it then save your theme options.', 'option-tree' ) . '</li>'; |
696 echo '<ul class="docs-ul">'; |
783 echo '</ul>'; |
697 echo '<li>'. __( 'End-Users mode does not allow deleting layouts.', 'option-tree' ) . '</li>'; |
784 |
698 echo '</ul>'; |
785 echo '<h4>' . esc_html__( 'End-Users Mode', 'option-tree' ) . ':</h4>'; |
699 |
786 |
700 echo '<h5>' . __( 'Edit Layout Data', 'option-tree' ) . ':</h5>'; |
787 echo '<h5>' . esc_html__( 'Creating a Layout', 'option-tree' ) . ':</h5>'; |
701 echo '<ul class="docs-ul">'; |
788 echo '<ul class="docs-ul">'; |
702 echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> tab.', 'option-tree' ) . '</li>'; |
789 |
703 echo '<li>' . __( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>'; |
790 /* translators: %s: visual path to the page */ |
704 echo '<li>' . __( 'Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.', 'option-tree' ) . '</li>'; |
791 $string = esc_html__( 'Go to the %s page.', 'option-tree' ); |
705 echo '</ul>'; |
792 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'Appearance->Theme Options', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
706 |
793 echo '<li>' . esc_html__( 'Enter a name for your layout in the text field and hit "New Layout", you\'ve created your first layout.', 'option-tree' ) . '</li>'; |
707 echo '</div>'; |
794 echo '<li>' . esc_html__( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>'; |
708 |
795 echo '</ul>'; |
709 echo '</div>'; |
796 |
710 |
797 echo '<h5>' . esc_html__( 'Activating a Layout', 'option-tree' ) . ':</h5>'; |
711 } |
798 echo '<ul class="docs-ul">'; |
712 |
799 |
713 } |
800 /* translators: %s: visual path to the page */ |
714 |
801 $string = esc_html__( 'Go to the %s page.', 'option-tree' ); |
715 /** |
802 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'Appearance->Theme Options', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
716 * Meta Boxes option type. |
803 echo '<li>' . esc_html__( 'Choose a layout from the select list and click the "Activate Layout" button.', 'option-tree' ) . '</li>'; |
717 * |
804 echo '</ul>'; |
718 * @return string |
805 |
719 * |
806 echo '<h5>' . esc_html__( 'Deleting a Layout', 'option-tree' ) . ':</h5>'; |
720 * @access public |
807 echo '<ul class="docs-ul">'; |
721 * @since 2.0 |
808 echo '<li>' . esc_html__( 'End-Users mode does not allow deleting layouts.', 'option-tree' ) . '</li>'; |
722 */ |
809 echo '</ul>'; |
|
810 |
|
811 echo '<h5>' . esc_html__( 'Edit Layout Data', 'option-tree' ) . ':</h5>'; |
|
812 echo '<ul class="docs-ul">'; |
|
813 |
|
814 /* translators: %s: visual path to the page */ |
|
815 $string = esc_html__( 'Go to the %s page.', 'option-tree' ); |
|
816 echo '<li>' . sprintf( $string, '<code>' . esc_html__( 'Appearance->Theme Options', 'option-tree' ) . '</code>' ) . '</li>'; // phpcs:ignore |
|
817 echo '<li>' . esc_html__( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>'; |
|
818 echo '<li>' . esc_html__( 'Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.', 'option-tree' ) . '</li>'; |
|
819 echo '</ul>'; |
|
820 |
|
821 echo '</div>'; |
|
822 |
|
823 echo '</div>'; |
|
824 } |
|
825 } |
|
826 |
723 if ( ! function_exists( 'ot_type_meta_boxes' ) ) { |
827 if ( ! function_exists( 'ot_type_meta_boxes' ) ) { |
724 |
828 |
725 function ot_type_meta_boxes() { |
829 /** |
726 |
830 * Meta Boxes option type. |
727 /* format setting outer wrapper */ |
831 * |
728 echo '<div class="format-setting type-textblock wide-desc">'; |
832 * @access public |
729 |
833 * @since 2.0 |
730 /* description */ |
834 */ |
731 echo '<div class="description">'; |
835 function ot_type_meta_boxes() { |
732 |
836 |
733 echo '<h4>'. __( 'How-to-guide', 'option-tree' ) . '</h4>'; |
837 // Format setting outer wrapper. |
734 |
838 echo '<div class="format-setting type-textblock wide-desc">'; |
735 echo '<p>' . __( 'There are a few simple steps you need to take in order to use OptionTree\'s built in Meta Box API. In the code below I\'ll show you a basic demo of how to create your very own custom meta box using any number of the option types you have at your disposal. If you would like to see some demo code, there is a directory named <code>theme-mode</code> inside the <code>assets</code> directory that contains a file named <code>demo-meta-boxes.php</code> you can reference.', 'option-tree' ) . '</p>'; |
839 |
736 |
840 // Description. |
737 echo '<p>' . __( 'It\'s important to note that Meta Boxes do not support WYSIWYG editors at this time and if you set one of your options to Textarea it will automatically revert to a Textarea Simple until a valid solution is found. WordPress released this statement regarding the wp_editor() function:', 'option-tree' ) . '</p>'; |
841 echo '<div class="description">'; |
738 |
842 |
739 echo '<blockquote>' . __( 'Once instantiated, the WYSIWYG editor cannot be moved around in the DOM. What this means in practical terms, is that you cannot put it in meta-boxes that can be dragged and placed elsewhere on the page.', 'option-tree' ) . '</blockquote>'; |
843 echo '<h4>' . esc_html__( 'How-to-guide', 'option-tree' ) . '</h4>'; |
740 |
844 |
741 echo '<h5>' . __( 'Create and include your custom meta boxes file.', 'option-tree' ) . '</h5>'; |
845 /* translators: %1$s: directory name, %2$s: directory name, %3$s: file type */ |
742 echo '<ul class="docs-ul">'; |
846 $string = esc_html__( 'There are a few simple steps you need to take in order to use OptionTree\'s built in Meta Box API. In the code below I\'ll show you a basic demo of how to create your very own custom meta box using any number of the option types you have at your disposal. If you would like to see some demo code, there is a directory named %1$s inside the %2$s directory that contains a file named %3$s you can reference.', 'option-tree' ); |
743 echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>meta-boxes.php</code>.', 'option-tree' ) . '</li>'; |
847 echo '<p>' . sprintf( $string, '<code>theme-mode</code>', '<code>assets</code>', '<code>demo-meta-boxes.php</code>' ) . '</p>'; // phpcs:ignore |
744 echo '<li>'. __( 'As well, you\'ll probably want to create a directory named <code>includes</code> to put your <code>meta-boxes.php</code> into which will help keep you file structure nice and tidy.', 'option-tree' ) . '</li>'; |
848 |
745 echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>'; |
849 echo '<p>' . esc_html__( 'It\'s important to note that Meta Boxes do not support WYSIWYG editors at this time and if you set one of your options to Textarea it will automatically revert to a Textarea Simple until a valid solution is found. WordPress released this statement regarding the wp_editor() function:', 'option-tree' ) . '</p>'; |
746 echo '</ul>'; |
850 |
747 |
851 echo '<blockquote>' . esc_html__( 'Once instantiated, the WYSIWYG editor cannot be moved around in the DOM. What this means in practical terms, is that you cannot put it in meta-boxes that can be dragged and placed elsewhere on the page.', 'option-tree' ) . '</blockquote>'; |
748 echo '<pre><code>/** |
852 |
|
853 echo '<h5>' . esc_html__( 'Create and include your custom meta boxes file.', 'option-tree' ) . '</h5>'; |
|
854 |
|
855 echo '<ul class="docs-ul">'; |
|
856 |
|
857 /* translators: %s: file name */ |
|
858 $string = esc_html__( 'Create a file and name it anything you want, maybe %s.', 'option-tree' ); |
|
859 echo '<li>' . sprintf( $string, '<code>meta-boxes.php</code>' ) . '</li>'; // phpcs:ignore |
|
860 |
|
861 /* translators: %1$s: directory name, %2$s: file name */ |
|
862 $string = esc_html__( 'As well, you\'ll probably want to create a directory named %1$s to put your %2$s into which will help keep you file structure nice and tidy.', 'option-tree' ); |
|
863 echo '<li>' . sprintf( $string, '<code>includes</code>', '<code>meta-boxes.php</code>' ) . '</li>'; // phpcs:ignore |
|
864 |
|
865 /* translators: %s: file name */ |
|
866 $string = esc_html__( 'Add the following code to your %s.', 'option-tree' ); |
|
867 echo '<li>' . sprintf( $string, '<code>functions.php</code>' ) . '</li>'; // phpcs:ignore |
|
868 |
|
869 echo '</ul>'; |
|
870 |
|
871 echo '<pre><code>/** |
749 * Meta Boxes |
872 * Meta Boxes |
750 */ |
873 */ |
751 require( trailingslashit( get_template_directory() ) . \'includes/meta-boxes.php\' ); |
874 require( trailingslashit( get_template_directory() ) . \'includes/meta-boxes.php\' ); |
752 </code></pre>'; |
875 </code></pre>'; |
753 |
876 |
754 echo '<ul class="docs-ul">'; |
877 echo '<ul class="docs-ul">'; |
755 echo '<li>' . __( 'Add a variation of the following code to your <code>meta-boxes.php</code>. You\'ll obviously need to fill it in with all your custom array values. It\'s important to note here that we use the <code>admin_init</code> filter because if you were to call the <code>ot_register_meta_box</code> function before OptionTree was loaded the sky would fall on your head.', 'option-tree' ) . '</li>'; |
878 |
756 echo '</ul>'; |
879 /* translators: %1$s: file name, %2$s: hook type, %3$s: function name */ |
757 |
880 $string = esc_html__( 'Add a variation of the following code to your %1$s. You\'ll obviously need to fill it in with all your custom array values. It\'s important to note here that we use the %2$s filter because if you were to call the %3$s function before OptionTree was loaded the sky would fall on your head.', 'option-tree' ); |
758 echo "<pre><code>/** |
881 echo '<li>' . sprintf( $string, '<code>meta-boxes.php</code>', '<code>admin_init</code>', '<code>ot_register_meta_box</code>' ) . '</li>'; // phpcs:ignore |
|
882 |
|
883 echo '</ul>'; |
|
884 |
|
885 echo "<pre><code>/** |
759 * Initialize the meta boxes. |
886 * Initialize the meta boxes. |
760 */ |
887 */ |
761 add_action( 'admin_init', 'custom_meta_boxes' ); |
888 add_action( 'admin_init', 'custom_meta_boxes' ); |
762 |
889 |
763 function custom_meta_boxes() { |
890 function custom_meta_boxes() { |
782 ) |
909 ) |
783 ); |
910 ); |
784 |
911 |
785 ot_register_meta_box( $my_meta_box ); |
912 ot_register_meta_box( $my_meta_box ); |
786 |
913 |
787 }</code></pre>"; |
914 }</code></pre>"; |
788 |
915 |
789 echo '</div>'; |
916 echo '</div>'; |
790 |
917 |
791 echo '</div>'; |
918 echo '</div>'; |
792 |
919 } |
793 } |
920 } |
794 |
921 |
795 } |
|
796 |
|
797 /** |
|
798 * Theme Mode option type. |
|
799 * |
|
800 * @return string |
|
801 * |
|
802 * @access public |
|
803 * @since 2.0 |
|
804 */ |
|
805 if ( ! function_exists( 'ot_type_theme_mode' ) ) { |
922 if ( ! function_exists( 'ot_type_theme_mode' ) ) { |
806 |
923 |
807 function ot_type_theme_mode() { |
924 /** |
808 |
925 * Theme Mode option type. |
809 /* format setting outer wrapper */ |
926 * |
810 echo '<div class="format-setting type-textblock wide-desc">'; |
927 * @access public |
811 |
928 * @since 2.0 |
812 /* description */ |
929 */ |
813 echo '<div class="description">'; |
930 function ot_type_theme_mode() { |
814 |
931 |
815 echo '<h4>'. __( 'How-to-guide', 'option-tree' ) . '</h4>'; |
932 // Format setting outer wrapper. |
816 |
933 echo '<div class="format-setting type-textblock wide-desc">'; |
817 echo '<p>' . __( 'There are a few simple steps you need to take in order to use OptionTree as a theme included module. In the code below I\'ll show you a basic demo of how to include the entire plugin as a module, which will allow you to have the most up-to-date version of OptionTree without ever needing to hack the core of the plugin. If you would like to see some demo code, there is a directory named <code>theme-mode</code> inside the <code>assets</code> directory that contains a file named <code>demo-theme-options.php</code> you can reference.', 'option-tree' ) . '</p>'; |
934 |
818 |
935 // Description. |
819 echo '<h5>' . __( 'Step 1: Include the plugin & turn on theme mode.', 'option-tree' ) . '</h5>'; |
936 echo '<div class="description">'; |
820 echo '<ul class="docs-ul">'; |
937 |
821 echo '<li>' . sprintf( __( 'Download the latest version of %s and unarchive the %s directory.', 'option-tree' ), '<a href="http://wordpress.org/extend/plugins/option-tree/" rel="nofollow" target="_blank">' . __( 'OptionTree', 'option-tree' ) . '</a>', '<code>.zip</code>' ) . '</li>'; |
938 echo '<h4>' . esc_html__( 'How-to-guide', 'option-tree' ) . '</h4>'; |
822 echo '<li>' . sprintf( __( 'Put the %s directory in the root of your theme. For example, the server path would be %s.', 'option-tree' ), '<code>option-tree</code>', '<code>/wp-content/themes/theme-name/option-tree/</code>' ) . '</li>'; |
939 |
823 echo '<li>' . sprintf( __( 'Add the following code to the beginning of your %s.', 'option-tree' ), '<code>functions.php</code>' ) . '</li>'; |
940 /* translators: %1$s: directory name, %2$s: directory name, %3$s: file type */ |
824 echo '</ul>'; |
941 $string = esc_html__( 'There are a few simple steps you need to take in order to use OptionTree as a theme included module. In the code below I\'ll show you a basic demo of how to include the entire plugin as a module, which will allow you to have the most up-to-date version of OptionTree without ever needing to hack the core of the plugin. If you would like to see some demo code, there is a directory named %1$s inside the %2$s directory that contains a file named %3$s you can reference.', 'option-tree' ); |
825 |
942 echo '<p>' . sprintf( $string, '<code>theme-mode</code>', '<code>assets</code>', '<code>demo-theme-options.php</code>' ) . '</p>'; // phpcs:ignore |
826 echo '<pre><code>/** |
943 |
|
944 echo '<h5>' . esc_html__( 'Step 1: Include the plugin & turn on theme mode.', 'option-tree' ) . '</h5>'; |
|
945 |
|
946 echo '<ul class="docs-ul">'; |
|
947 |
|
948 /* translators: %1$s: directory name, %2$s: file type */ |
|
949 $string = esc_html__( 'Download the latest version of %1$s and unarchive the %2$s directory.', 'option-tree' ); |
|
950 echo '<li>' . sprintf( $string, '<a href="https://wordpress.org/plugins/option-tree/" rel="nofollow" target="_blank">' . esc_html__( 'OptionTree', 'option-tree' ) . '</a>', '<code>.zip</code>' ) . '</li>'; // phpcs:ignore |
|
951 |
|
952 /* translators: %1$s: directory name, %2$s: directory path */ |
|
953 $string = esc_html__( 'Put the %1$s directory in the root of your theme. For example, the server path would be %2$s.', 'option-tree' ); |
|
954 echo '<li>' . sprintf( $string, '<code>option-tree</code>', '<code>/wp-content/themes/theme-name/option-tree/</code>' ) . '</li>'; // phpcs:ignore |
|
955 |
|
956 /* translators: %s: file name */ |
|
957 $string = esc_html__( 'Add the following code to the beginning of your %s.', 'option-tree' ); |
|
958 echo '<li>' . sprintf( $string, '<code>functions.php</code>' ) . '</li>'; // phpcs:ignore |
|
959 |
|
960 echo '</ul>'; |
|
961 |
|
962 echo '<pre><code>/** |
827 * Required: set \'ot_theme_mode\' filter to true. |
963 * Required: set \'ot_theme_mode\' filter to true. |
828 */ |
964 */ |
829 add_filter( \'ot_theme_mode\', \'__return_true\' ); |
965 add_filter( \'ot_theme_mode\', \'__return_true\' ); |
830 |
966 |
831 /** |
967 /** |
832 * Required: include OptionTree. |
968 * Required: include OptionTree. |
833 */ |
969 */ |
834 require( trailingslashit( get_template_directory() ) . \'option-tree/ot-loader.php\' ); |
970 require( trailingslashit( get_template_directory() ) . \'option-tree/ot-loader.php\' ); |
835 </code></pre>'; |
971 </code></pre>'; |
836 |
972 |
837 echo '<p>' . sprintf( __( 'For a list of all the OptionTree UI display filters refer to the %s file found in the %s directory of this plugin. This file is the starting point for developing themes with Theme Mode.', 'option-tree' ), '<code>demo-functions.php</code>', '<code>/assets/theme-mode/</code>' ) . '</p>'; |
973 /* translators: %1$s: file name, %2$s: directory path */ |
838 |
974 $string = esc_html__( 'For a list of all the OptionTree UI display filters refer to the %1$s file found in the %2$s directory of this plugin. This file is the starting point for developing themes with Theme Mode.', 'option-tree' ); |
839 echo '<p class="aside">' . __( 'You now have OptionTree built into your theme and anytime an update is available replace the old version with the new one.', 'option-tree' ) . '</p>'; |
975 echo '<p>' . sprintf( $string, '<code>demo-functions.php</code>', '<code>/assets/theme-mode/</code>' ) . '</p>'; // phpcs:ignore |
840 |
976 |
841 echo '<h5>' . __( 'Step 2: Create Theme Options without using the UI Builder.', 'option-tree' ) . '</h5>'; |
977 echo '<p class="aside">' . esc_html__( 'You now have OptionTree built into your theme and anytime an update is available replace the old version with the new one.', 'option-tree' ) . '</p>'; |
842 echo '<ul class="docs-ul">'; |
978 |
843 echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>theme-options.php</code>, or use the built in file export to create it for you. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' ) . '</li>'; |
979 echo '<h5>' . esc_html__( 'Step 2: Create Theme Options without using the UI Builder.', 'option-tree' ) . '</h5>'; |
844 echo '<li>'. __( 'As well, you\'ll probably want to create a directory named <code>includes</code> to put your <code>theme-options.php</code> into which will help keep you file structure nice and tidy.', 'option-tree' ) . '</li>'; |
980 echo '<ul class="docs-ul">'; |
845 echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>'; |
981 |
846 echo '</ul>'; |
982 /* translators: %s: file name */ |
847 |
983 $string = esc_html__( 'Create a file and name it anything you want, maybe %s, or use the built in file export to create it for you. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' ); |
848 echo '<pre><code>/** |
984 echo '<li>' . sprintf( $string, '<code>theme-options.php</code>' ) . '</li>'; // phpcs:ignore |
|
985 |
|
986 /* translators: %1$s: directory name, %2$s: file name */ |
|
987 $string = esc_html__( 'As well, you\'ll probably want to create a directory named %1$s to put your %2$s into which will help keep you file structure nice and tidy.', 'option-tree' ); |
|
988 echo '<li>' . sprintf( $string, '<code>includes</code>', '<code>theme-options.php</code>' ) . '</li>'; // phpcs:ignore |
|
989 |
|
990 /* translators: %s: file name */ |
|
991 $string = esc_html__( 'Add the following code to your %s.', 'option-tree' ); |
|
992 echo '<li>' . sprintf( $string, '<code>functions.php</code>' ) . '</li>'; // phpcs:ignore |
|
993 |
|
994 echo '</ul>'; |
|
995 |
|
996 echo '<pre><code>/** |
849 * Theme Options |
997 * Theme Options |
850 */ |
998 */ |
851 require( trailingslashit( get_template_directory() ) . \'includes/theme-options.php\' ); |
999 require( trailingslashit( get_template_directory() ) . \'includes/theme-options.php\' ); |
852 </code></pre>'; |
1000 </code></pre>'; |
853 |
1001 |
854 echo '<ul class="docs-ul">'; |
1002 echo '<ul class="docs-ul">'; |
855 echo '<li>' . __( 'Add a variation of the following code to your <code>theme-options.php</code>. You\'ll obviously need to fill it in with all your custom array values for contextual help (optional), sections (required), and settings (required).', 'option-tree' ) . '</li>'; |
1003 |
856 echo '</ul>'; |
1004 /* translators: %s: file name */ |
857 |
1005 $string = esc_html__( 'Add a variation of the following code to your %s. You\'ll obviously need to fill it in with all your custom array values for contextual help (optional), sections (required), and settings (required).', 'option-tree' ); |
858 echo '<p>' . __( 'The code below is a boilerplate to get your started. For a full list of the available option types click the "Option Types" tab above. Also a quick note, you don\'t need to put OptionTree in theme mode to manually create options but you will want to hide the docs and settings as each time you load the admin area the settings be written over with the code below if they\'ve changed in any way. However, this ensures your settings do not get tampered with by the end-user.', 'option-tree' ) . '</p>'; |
1006 echo '<li>' . sprintf( $string, '<code>theme-options.php</code>' ) . '</li>'; // phpcs:ignore |
859 |
1007 |
860 echo "<pre><code>/** |
1008 echo '</ul>'; |
|
1009 |
|
1010 echo '<p>' . esc_html__( 'The code below is a boilerplate to get your started. For a full list of the available option types click the "Option Types" tab above. Also a quick note, you don\'t need to put OptionTree in theme mode to manually create options but you will want to hide the docs and settings as each time you load the admin area the settings be written over with the code below if they\'ve changed in any way. However, this ensures your settings do not get tampered with by the end-user.', 'option-tree' ) . '</p>'; |
|
1011 |
|
1012 echo "<pre><code>/** |
861 * Initialize the options before anything else. |
1013 * Initialize the options before anything else. |
862 */ |
1014 */ |
863 add_action( 'init', 'custom_theme_options', 1 ); |
1015 add_action( 'init', 'custom_theme_options', 1 ); |
864 |
1016 |
865 /** |
1017 /** |