├── assets ├── screenshot-1.png ├── screenshot-2.png ├── screenshot-3.png ├── screenshot-4.png ├── screenshot-5.png └── screenshot-6.png ├── lang ├── acf-options-page-adder-pt_PT.mo ├── acf-options-page-adder-ru_RU.mo ├── acf-options-page-adder.pot ├── acf-options-page-adder-ru_RU.po └── acf-options-page-adder-pt_PT.po ├── .gitignore ├── options-pages.js ├── api-template.php ├── README.md ├── readme.txt └── options-pages.php /assets/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/assets/screenshot-1.png -------------------------------------------------------------------------------- /assets/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/assets/screenshot-2.png -------------------------------------------------------------------------------- /assets/screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/assets/screenshot-3.png -------------------------------------------------------------------------------- /assets/screenshot-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/assets/screenshot-4.png -------------------------------------------------------------------------------- /assets/screenshot-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/assets/screenshot-5.png -------------------------------------------------------------------------------- /assets/screenshot-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/assets/screenshot-6.png -------------------------------------------------------------------------------- /lang/acf-options-page-adder-pt_PT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/lang/acf-options-page-adder-pt_PT.mo -------------------------------------------------------------------------------- /lang/acf-options-page-adder-ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hube2/acf-options-page-adder/HEAD/lang/acf-options-page-adder-ru_RU.mo -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .DS_Store? 3 | ._* 4 | .Spotlight-V100 5 | .Trashes 6 | ehthumbs.db 7 | Thumbs.db 8 | _notes 9 | *.LCK 10 | /__assets 11 | -------------------------------------------------------------------------------- /options-pages.js: -------------------------------------------------------------------------------- 1 | 2 | jQuery(document).ready(function($){ 3 | //console.log($('li[class*="acfop-fontawesome-"]')); 4 | $('li[class*="acfop-fontawesome-"]').each(function(index, element) { 5 | //console.log($(element)); 6 | var $classes = element.className.split(/\s+/); 7 | var $class = ''; 8 | for (i=0; i<$classes.length; i++) { 9 | if ($classes[i].substr(0, 18) == 'acfop-fontawesome-') { 10 | $class = $classes[i]; 11 | break; 12 | } 13 | } 14 | $class = $class.substr(18); 15 | $classes = $class.split(/_/); 16 | //console.log($classes); 17 | $class = $class.replace(/_/, ' '); 18 | //console.log($class); 19 | $(element).find('.wp-menu-image').each(function(index, element) { 20 | $(element).empty(); 21 | $(element).removeClass('dashicons-before'); 22 | $(element).append(''); 23 | $(element).append('
'); 24 | for (i=0; i<$classes.length; i++) { 25 | //$(element).addClass($classes[i]); 26 | } 27 | }); 28 | }); 29 | 30 | }); -------------------------------------------------------------------------------- /api-template.php: -------------------------------------------------------------------------------- 1 | $page) { 21 | if ($page_slug == $slug) { 22 | $post_id = $page['post_id']; 23 | // if parent slug not empty then break 24 | if (!empty($page['parent_slug'])) { 25 | break; 26 | } 27 | // if parent slug is empty and !redirect then break 28 | if ($page['redirect']) { 29 | if (isset($pages[$page['menu_slug']])) { 30 | $post_id = $pages[$page['menu_slug']]['post_id']; 31 | break; 32 | } 33 | } 34 | } 35 | } // end foreach $page 36 | return $post_id; 37 | } // end function get_option_page_id 38 | } // end if !function 39 | 40 | if (!function_exists('get_options_page_id')) { 41 | function get_options_page_id($slug) { 42 | return get_option_page_id($slug); 43 | } // end function get_options_page_id 44 | } // end if !function 45 | 46 | if (!function_exists('get_option_page_id_filter')) { 47 | function get_option_page_id_filter($post_id='', $slug='') { 48 | return get_option_page_id($slug); 49 | } // end function function get_option_page_id_filter 50 | add_filter('acf/get_options_page_id', 'get_option_page_id_filter', 10, 2); 51 | } // end if !function 52 | 53 | ?> -------------------------------------------------------------------------------- /lang/acf-options-page-adder.pot: -------------------------------------------------------------------------------- 1 | # ACF Options Page Adder Pot 2 | # Copyright (C) 2014 ... 3 | # This file is distrubuted under the GPL-2.0+ 4 | #, fuzzy 5 | msgid "" 6 | msgstr "" 7 | "Project-Id-Version: ACF Options Page Adder\n" 8 | "Report-Msgid-Bugs-To: Translator Name \n" 9 | "POT-Creation-Date: 2017-03-20 15:11-0400\n" 10 | "PO-Revision-Date: \n" 11 | "Last-Translator: John Huebner \n" 12 | "Language-Team: \n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Plural-Forms: nplurals=2; plural=n != 1;\n" 17 | "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n" 18 | "X-Poedit-SourceCharset: UTF-8\n" 19 | "X-Poedit-KeywordsList: __;_e;_x;esc_html_e;esc_html__;esc_attr_e;esc_attr__;" 20 | "_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2;_n_noop:1,2;" 21 | "__ngettext_noop:1,2;_c,_nc:4c,1,2\n" 22 | "X-Poedit-Basepath: ..\n" 23 | "X-Generator: Poedit 1.8.11\n" 24 | "X-Poedit-SearchPath-0: .\n" 25 | "X-Poedit-SearchPathExcluded-0: __assets\n" 26 | 27 | #: options-pages.php:132 28 | msgid "ACF Options Page Admin" 29 | msgstr "" 30 | 31 | #: options-pages.php:171 32 | msgid "Options Page Details" 33 | msgstr "" 34 | 35 | #: options-pages.php:175 36 | msgid "Basic Settings" 37 | msgstr "" 38 | 39 | #: options-pages.php:191 40 | msgid "Title Text" 41 | msgstr "" 42 | 43 | #: options-pages.php:195 44 | msgid "This will be used as the options page title." 45 | msgstr "" 46 | 47 | #: options-pages.php:208 options-pages.php:745 48 | msgid "Menu Text" 49 | msgstr "" 50 | 51 | #: options-pages.php:212 52 | msgid "Will default to title if left blank." 53 | msgstr "" 54 | 55 | #: options-pages.php:225 56 | msgid "Menu Location (Parent)" 57 | msgstr "" 58 | 59 | #: options-pages.php:229 60 | msgid "" 61 | "Select the menu this options page will appear under. Will default to None." 62 | msgstr "" 63 | 64 | #: options-pages.php:244 options-pages.php:746 65 | msgid "Slug" 66 | msgstr "" 67 | 68 | #: options-pages.php:248 69 | msgid "" 70 | "This field is optional in ACF. It is required here. You must know what the " 71 | "slug is to enable get_options_page_post_id() added in 4.4.0" 72 | msgstr "" 73 | 74 | #: options-pages.php:261 options-pages.php:750 75 | msgid "Order" 76 | msgstr "" 77 | 78 | #: options-pages.php:265 79 | msgid "The order that this child menu should appear under its parent menu." 80 | msgstr "" 81 | 82 | #: options-pages.php:286 83 | msgid "Advanced Settings" 84 | msgstr "" 85 | 86 | #: options-pages.php:302 options-pages.php:751 87 | msgid "Capability" 88 | msgstr "" 89 | 90 | #: options-pages.php:306 91 | msgid "" 92 | "The user capability to view this options page. Will default to " 93 | "manage_options." 94 | msgstr "" 95 | 96 | #: options-pages.php:321 97 | msgid "Menu Position" 98 | msgstr "" 99 | 100 | #: options-pages.php:325 101 | msgid "" 102 | "The position in the menu order this menu should appear. WARNING: if two menu " 103 | "items use the same position attribute, one of the items may be overwritten " 104 | "so that only one item displays! Risk of conflict can be reduced by using " 105 | "decimal instead of integer values, e.g. 63.3 instead of 63. Defaults to " 106 | "bottom of utility menu items.
Core Menu Item Positions: " 107 | "2=Dashboard, 4=Separator, 5=Posts, 10=Media, 15=Links, 20=Pages, " 108 | "25=Comments, 59=Separator, 60=Appearance, 65=Plugins, 70=Users, 75=Tools, " 109 | "80=Settings, 99=Separator" 110 | msgstr "" 111 | 112 | #: options-pages.php:348 113 | msgid "Icon" 114 | msgstr "" 115 | 116 | #: options-pages.php:352 117 | msgid "" 118 | "The icon url for this menu. Defaults to default WordPress gear.
Check out https://developer.wordpress.org/resource/dashicons/ " 121 | "for what to put in this field." 122 | msgstr "" 123 | 124 | #: options-pages.php:373 options-pages.php:748 125 | msgid "Redirect" 126 | msgstr "" 127 | 128 | #: options-pages.php:377 options-pages.php:451 options-pages.php:849 129 | msgid "Yes" 130 | msgstr "" 131 | 132 | #: options-pages.php:378 options-pages.php:452 options-pages.php:851 133 | msgid "No" 134 | msgstr "" 135 | 136 | #: options-pages.php:379 137 | msgid "" 138 | "If set to Yes, this options page will redirect to the first child page (if a " 139 | "child page exists). If set to No, this parent page will appear alongside any " 140 | "child pages. Defaults to Yes.
NOTE: Changing this setting " 141 | "will effect the location or appearance of sub options pages currently " 142 | "associated with this options page." 143 | msgstr "" 144 | 145 | #: options-pages.php:394 options-pages.php:749 146 | msgid "Save To" 147 | msgstr "" 148 | 149 | #: options-pages.php:397 150 | msgid "" 151 | "ACF v5.2.7 added the ability to save and load data to/from a post rather " 152 | "than options.
When saving values to this post do not use field " 153 | "names in your field groups that start with _acfop_." 154 | msgstr "" 155 | 156 | #: options-pages.php:406 options-pages.php:774 options-pages.php:788 157 | msgid "Options" 158 | msgstr "" 159 | 160 | #: options-pages.php:407 161 | msgid "Post Object" 162 | msgstr "" 163 | 164 | #: options-pages.php:408 options-pages.php:778 options-pages.php:790 165 | msgid "This Post" 166 | msgstr "" 167 | 168 | #: options-pages.php:417 169 | msgid "Post/Page" 170 | msgstr "" 171 | 172 | #: options-pages.php:420 173 | msgid "Select the post object to save and load data to/from." 174 | msgstr "" 175 | 176 | #: options-pages.php:447 177 | msgid "Autoload Values" 178 | msgstr "" 179 | 180 | #: options-pages.php:453 181 | msgid "" 182 | "Whether to load the options (values saved from this options page) when " 183 | "WordPress starts up. Added in ACF v5.2.8." 184 | msgstr "" 185 | 186 | #: options-pages.php:468 187 | msgid "Customize" 188 | msgstr "" 189 | 190 | #: options-pages.php:484 191 | msgid "Header Content" 192 | msgstr "" 193 | 194 | #: options-pages.php:487 195 | msgid "" 196 | "Content will be added to the options page header after the Options Page " 197 | "Title." 198 | msgstr "" 199 | 200 | #: options-pages.php:503 201 | msgid "Footer Content" 202 | msgstr "" 203 | 204 | #: options-pages.php:506 205 | msgid "" 206 | "Content will be added to the options page footer after all ACF Field Groups." 207 | msgstr "" 208 | 209 | #: options-pages.php:744 210 | msgid "Post ID" 211 | msgstr "" 212 | 213 | #: options-pages.php:747 214 | msgid "Location (Parent)" 215 | msgstr "" 216 | 217 | #: options-pages.php:752 218 | msgid "Hook Suffix" 219 | msgstr "" 220 | 221 | #: options-pages.php:776 options-pages.php:792 222 | msgid "Post" 223 | msgstr "" 224 | 225 | #: options-pages.php:786 226 | msgid "1st sub option page value
OR
" 227 | msgstr "" 228 | 229 | #: options-pages.php:862 230 | msgid "None" 231 | msgstr "" 232 | 233 | #: options-pages.php:939 options-pages.php:954 options-pages.php:956 234 | msgid "Options Pages" 235 | msgstr "" 236 | 237 | #: options-pages.php:955 238 | msgid "Options Page" 239 | msgstr "" 240 | 241 | #: options-pages.php:957 242 | msgid "Add Options Page" 243 | msgstr "" 244 | 245 | #: options-pages.php:958 246 | msgid "Add New Options Page" 247 | msgstr "" 248 | 249 | #: options-pages.php:959 250 | msgid "Edit" 251 | msgstr "" 252 | 253 | #: options-pages.php:960 254 | msgid "Edit Options Page" 255 | msgstr "" 256 | 257 | #: options-pages.php:961 258 | msgid "New Options Page" 259 | msgstr "" 260 | 261 | #: options-pages.php:962 options-pages.php:963 262 | msgid "View Options Page" 263 | msgstr "" 264 | 265 | #: options-pages.php:964 266 | msgid "Search Options Pages" 267 | msgstr "" 268 | 269 | #: options-pages.php:965 270 | msgid "No Options Pages Found" 271 | msgstr "" 272 | 273 | #: options-pages.php:966 274 | msgid "No Options Pages Found in Trash" 275 | msgstr "" 276 | 277 | #: options-pages.php:967 278 | msgid "Parent Options Page" 279 | msgstr "" 280 | 281 | #: options-pages.php:1030 282 | msgid "Plugins by John Huebner" 283 | msgstr "" 284 | 285 | #: options-pages.php:1047 286 | msgid "Thank you for using my plugins" 287 | msgstr "" 288 | 289 | #: options-pages.php:1056 290 | msgid "Documentation" 291 | msgstr "" 292 | 293 | #: options-pages.php:1064 294 | msgid "Please consider making a small donation." 295 | msgstr "" 296 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This plugin has been discontinued, it is no longer needed, all of the functionality of this plugin is not available in ACF Pro. The plugin is no longer maintained and I will no longer supply support for this plugin. Use this plugin at your own risk. 2 | 3 | ACF Options Page Admin 4 | ========================================== 5 | 6 | Allows creation of options pages using Advanced Custom Fields Pro without needing to do any 7 | PHP coding. 8 | 9 | **Requires that ACF5 Pro is installed.** 10 | 11 | This plugin will not provide any functionality if ACF5 Pro is not installed and active 12 | 13 | ## Installation 14 | 15 | * Download and decompress plugin 16 | * Create a folder in your plugins folder named "acf-options-page-adder" 17 | * Upload files to the folder you just created 18 | * Activate plugin 19 | 20 | ## Options Pages 21 | Allows adding options pages though an admin interface. Supports all the features of 22 | ACF Options Pages. For more information see 23 | http://www.advancedcustomfields.com/resources/options-page/ 24 | 25 | ## Change capability 26 | The capability required to add/edit options pages was changed to "manage_options" in version 3.3.0. 27 | This can be altered by adding a filter 28 | ``` 29 | add_filter('acf-options-page-adder/capability', 'my_acf_options_page_adder_cap'); 30 | function my_acf_options_page_adder_cap($cap) { 31 | $cap = 'edit_published_posts'; 32 | return $cap; 33 | } 34 | ``` 35 | 36 | ## Get Options Page Save to ID 37 | 38 | Added in version 3.5.0 functions to get the options save to value ($post_id), also added a filter. This 39 | function or filter will return the current "post_id" setting of for an "menu_slug". It will return either 40 | "options" or a post ID if the options page is set to save values to a post object. 41 | Example of use 42 | ``` 43 | // example 1: get_options_page_id() 44 | 45 | // get the post_id of an options page 46 | $post_id = get_options_page_id('my_options_page_slug'); 47 | // get a value using $post_id 48 | $value = get_field('my_option_field', $post_id); 49 | ``` 50 | 51 | ``` 52 | // example 2: by filter 53 | $default = 'option', 54 | $slug = 'my_options_page_slug'; 55 | $post_id = apply_filters('get_option_page_id_filter', $default, $slug); 56 | $value = get_field('my_option_field', $post_id); 57 | 58 | // or like this 59 | $value = get_field('my_option_field', apply_filters('get_option_page_id_filter', $default, $slug)); 60 | ``` 61 | 62 | There is a condition where you will get the incorrect post id. This condition is created by having a 63 | top level redirect page that is set to redirect to the first sub options page. If there is no sub options 64 | page that exists then it will return the value for the top level options page. If you later create a 65 | sub options page it will return the new value from the sub options page. This is why I have see the 66 | default value of redirect to false. If you want the top level page to redirect the you need to be aware 67 | that it can cause you issues later down the road if you haven't created a sub option page. You should also specifically set the order of sub options pages so that these do not change at some point in the future 68 | because adding a new options page with the same order as the existing top level page will alter the save 69 | and get location to the new options page. There's noting I can do about this, it the way it works. When 70 | setting up ACF options pages to save to a post instead of options you must be more precise in with the 71 | options page arguments. 72 | 73 | ## Warning 74 | If you have created ACF options pages manually in code then there is a condition where this plugin will 75 | not correctly detect the top level options page in a group and will not be able to successfully add 76 | sub options pages to that group. This will happen if you have the top level options page set to redirect 77 | to the first sub options page. This problem can be avoided if 78 | ``` 79 | $menu_slug == strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $page_title), '-')); 80 | ``` 81 | In other words, the slug must be all lower case and contain only letters, numbers and dashes 82 | (hyphens -) and that there is never 2 or more consecutive dashes. 83 | 84 | Options page groups added using this plugin work correctly as this problem is dealt with internally. 85 | 86 | ## Saving options page values to a post ID 87 | ACF v5.2.7 added the ability to save options page fields to a post ID, so here's a hint. 88 | Why not save your values to the options page post that is created when you set up an options page using 89 | this plugin? The post type is already created and it really is a perfect place to store the values. Here's 90 | a bonus, if you delete the options page then all of those values will be deleted right long with it. 91 | You can even use `get_fields($options_page_id)` without needing to worry about getting the fields for 92 | the options page itself. Why? because all the fields used for creating the options page start with an 93 | underscore `_` and will not be returned by `get_fields()`. The only thing you need to be careful of is not 94 | using any of the field names used by this plugin, which should be extremely easy since they all start with 95 | `_acfop_`. 96 | 97 | ## Saving options page values with a custom slug as the post ID 98 | It is posible to use a custom slug for saving options page values. For example, if you wanted to save values of an options page to a user you could supply "user_1" as the "$post_id" value for the opitons page. This also has another side effect. Normally, when ACF saves values to "options" in the options table you will find the fields with the "options_" prefix. So for example, if your field name is "my_field" then in the options table you will find "options_my_field" as the options name. You can supply a custom slug for this, let's say that you set the post ID setting for the options page to "my-custom-slug". this would cause the same field in the options page to have the name "my-custom-slug_my_field". 2 New options have been added to this plugin and you can choose to use the options page slug for the post ID or you can specify a custom slug to use instead. 99 | 100 | 101 | ## Customize Options Page 102 | Version 3.8.0 of this plugin added the ability to customize the ACF options page by adding header and footer content. In addtion to the WYSIWYG fields that have been added to the options page admin editor you can also customize these sections, or the entire options page using filters. 103 | 104 | Version 3.8.2 of this plugin adds a toggle to enable this feature. This feature can cause an out of 105 | memory fatal error on options pages that have large numbers of fields. If content was entered into this field before the toggle to turn in on then the toggle will be automatically turned on. Otherwise the default for this option will be off. 106 | 107 | **Header Content** 108 | 109 | ``` 110 | add_filter('acf-options-page-adder/page-header', 'my_custom_options_page_header', 10, 2); 111 | 112 | function my_custom_options_page_header($content, $hook) { 113 | // $content = content, by default it is '' or the value of the WYSIWYG editor 114 | // $hook = the current options page hook that is being called 115 | $content = '

My Custom Header Content

'; 116 | return $content; 117 | } 118 | ``` 119 | 120 | **Footer Content** 121 | 122 | ``` 123 | add_filter('acf-options-page-adder/page-footer', 'my_custom_options_page_footer', 10, 2); 124 | 125 | function my_custom_options_page_footer($content, $hook) { 126 | // $content = content, by default it is '' or the value of the WYSIWYG editor 127 | // $hook = the current options page hook that is being called 128 | $content = '

My Custom Footer Content

'; 129 | return $content; 130 | } 131 | ``` 132 | 133 | **Filter Entire Options Page** 134 | 135 | ``` 136 | add_filter('acf-options-page-adder/page-content', 'my_custom_options_page_filter', 10, 2); 137 | 138 | function my_custom_options_page_filter($content, $hook) { 139 | // $content = entire content or options page, including all ACF fields 140 | // $hook = the current options page hook that is being called 141 | // caution should be taken when making modification to the page content 142 | return $content; 143 | } 144 | ``` 145 | 146 | ### Donations 147 | If you find my work useful and you have a desire to send me money, which will give me an incentive to continue 148 | offering and maintaining the plugins I've made public in my many repositories, I'm not going to turn it down 149 | and whatever you feel my work is worth will be greatly appreciated. You can send money through paypal to 150 | hube02[AT]earthlink[dot]net. 151 | 152 | #### Automatic Updates 153 | Github updater support has been removed. This plugin has been published to WordPress.Org here 154 | https://wordpress.org/plugins/options-page-admin-for-acf/. If you are having problems updating please 155 | try installing from there. 156 | 157 | #### Remove Nag 158 | You may notice that I've started adding a little nag to my plugins. It's just a box on some pages that lists my 159 | plugins that you're using with a request do consider making a donation for using them. If you want to disable them 160 | add the following filter to your functions.php file. 161 | ``` 162 | add_filter('remove_hube2_nag', '__return_true'); 163 | ``` 164 | -------------------------------------------------------------------------------- /lang/acf-options-page-adder-ru_RU.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: ACF Options Page Adder\n" 6 | "Report-Msgid-Bugs-To: Translator Name \n" 7 | "POT-Creation-Date: 2017-04-19 23:02+0300\n" 8 | "PO-Revision-Date: 2017-04-19 23:02+0300\n" 9 | "Last-Translator: Pedro Mendonça \n" 10 | "Language-Team: Pedro Mendonça \n" 11 | "Language: ru\n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 16 | "X-Generator: Poedit 1.8.12\n" 17 | "X-Poedit-SourceCharset: UTF-8\n" 18 | "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 19 | "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;" 20 | "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" 21 | "X-Textdomain-Support: yes\n" 22 | "X-Poedit-Basepath: ..\n" 23 | "X-Poedit-WPHeader: options-pages.php\n" 24 | "X-Poedit-SearchPath-0: .\n" 25 | "X-Poedit-SearchPathExcluded-0: *.js\n" 26 | 27 | #: options-pages.php:132 28 | msgid "ACF Options Page Admin" 29 | msgstr "Настройка страниц опций для ACF" 30 | 31 | #: options-pages.php:171 32 | msgid "Options Page Details" 33 | msgstr "Настройки страницы опций" 34 | 35 | #: options-pages.php:175 36 | msgid "Basic Settings" 37 | msgstr "Основные настройки" 38 | 39 | #: options-pages.php:191 40 | msgid "Title Text" 41 | msgstr "Заголовок" 42 | 43 | #: options-pages.php:195 44 | msgid "This will be used as the options page title." 45 | msgstr "Используется как заголовок страницы опций" 46 | 47 | #: options-pages.php:208 options-pages.php:745 48 | msgid "Menu Text" 49 | msgstr "Название пункта меню" 50 | 51 | #: options-pages.php:212 52 | msgid "Will default to title if left blank." 53 | msgstr "" 54 | "По умолчанию будет равно названию страницы опций (если оставить пустым)." 55 | 56 | #: options-pages.php:225 57 | msgid "Menu Location (Parent)" 58 | msgstr "Родительское меню" 59 | 60 | #: options-pages.php:229 61 | msgid "" 62 | "Select the menu this options page will appear under. Will default to None." 63 | msgstr "" 64 | "Укажите в какой раздел меню поместить данную страницу опций. Или оставьте " 65 | "это поле пустым чтоб поместить ее в главное меню." 66 | 67 | #: options-pages.php:244 options-pages.php:746 68 | msgid "Slug" 69 | msgstr "Ссылка" 70 | 71 | #: options-pages.php:248 72 | msgid "" 73 | "This field is optional in ACF. It is required here. You must know what the " 74 | "slug is to enable get_options_page_post_id() added in 4.4.0" 75 | msgstr "" 76 | "Ссылка для страницы опций. Значение должно содержать латинские символы, " 77 | "подчеркивание и дефис. Например: my_settings" 78 | 79 | #: options-pages.php:261 options-pages.php:750 80 | msgid "Order" 81 | msgstr "Родительское меню" 82 | 83 | #: options-pages.php:265 84 | msgid "The order that this child menu should appear under its parent menu." 85 | msgstr "Укажите порядковый номер расположения в дочернем меню." 86 | 87 | #: options-pages.php:286 88 | msgid "Advanced Settings" 89 | msgstr "Дополнительные настройки" 90 | 91 | #: options-pages.php:302 options-pages.php:751 92 | msgid "Capability" 93 | msgstr "Совместимость" 94 | 95 | #: options-pages.php:306 96 | msgid "" 97 | "The user capability to view this options page. Will default to " 98 | "manage_options." 99 | msgstr "" 100 | "Поддержка определенного типа совместимости. По умолчанию manage_options." 101 | 102 | #: options-pages.php:321 103 | msgid "Menu Position" 104 | msgstr "Порядок в главном меню" 105 | 106 | #: options-pages.php:325 107 | msgid "" 108 | "The position in the menu order this menu should appear. WARNING: if two menu " 109 | "items use the same position attribute, one of the items may be overwritten " 110 | "so that only one item displays! Risk of conflict can be reduced by using " 111 | "decimal instead of integer values, e.g. 63.3 instead of 63. Defaults to " 112 | "bottom of utility menu items.
Core Menu Item Positions: " 113 | "2=Dashboard, 4=Separator, 5=Posts, 10=Media, 15=Links, 20=Pages, " 114 | "25=Comments, 59=Separator, 60=Appearance, 65=Plugins, 70=Users, 75=Tools, " 115 | "80=Settings, 99=Separator" 116 | msgstr "" 117 | "В какой позиции разместить ссылку на эту страницу. Предупреждение: Можно " 118 | "использовать десятичные дроби, а не целые значения, например, 63.3 вместо " 119 | "63. Позиции для размещения: 2=Консоль, 4=Разделитель, 5=Записи, " 120 | "10=Медиафайлы, 15=Ссылки, 20=Страницы, 25=Комментарии, 59=Разделитель, " 121 | "60=Внешний вид, 65=Плагины, 70=Пользователи, 75=Инструменты, 80=Настройки, " 122 | "99=Разделитель" 123 | 124 | #: options-pages.php:348 125 | msgid "Icon" 126 | msgstr "Иконка" 127 | 128 | #: options-pages.php:352 129 | msgid "" 130 | "The icon url for this menu. Defaults to default WordPress gear.
Check out https://developer.wordpress.org/resource/dashicons/ " 133 | "for what to put in this field." 134 | msgstr "" 135 | "Иконка для меню. Вы можете выбрать иконку на странице https://" 137 | "developer.wordpress.org/resource/dashicons/ В поле вставляется имя " 138 | "иконки, например: dashicons-menu" 139 | 140 | #: options-pages.php:373 options-pages.php:748 141 | msgid "Redirect" 142 | msgstr "Перенаправление" 143 | 144 | #: options-pages.php:377 options-pages.php:451 options-pages.php:849 145 | msgid "Yes" 146 | msgstr "Да" 147 | 148 | #: options-pages.php:378 options-pages.php:452 options-pages.php:851 149 | msgid "No" 150 | msgstr "Нет" 151 | 152 | #: options-pages.php:379 153 | msgid "" 154 | "If set to Yes, this options page will redirect to the first child page (if a " 155 | "child page exists). If set to No, this parent page will appear alongside any " 156 | "child pages. Defaults to Yes.
NOTE: Changing this setting " 157 | "will effect the location or appearance of sub options pages currently " 158 | "associated with this options page." 159 | msgstr "" 160 | "Если выбрать ДА, то будет происходить переход на первую дочернюю страницу " 161 | "(если такая страница существует). Если выбрать НЕТ, то эта родительская " 162 | "страница будет отображаться среди дочерних страниц.
ЗАМЕЧАНИЕ: Данная настройка позволяет управлять расположением " 164 | "дочерних страниц опций." 165 | 166 | #: options-pages.php:394 options-pages.php:749 167 | msgid "Save To" 168 | msgstr "Сохранить как" 169 | 170 | #: options-pages.php:397 171 | msgid "" 172 | "ACF v5.2.7 added the ability to save and load data to/from a post rather " 173 | "than options.
When saving values to this post do not use field " 174 | "names in your field groups that start with _acfop_." 175 | msgstr "" 176 | "В версии ACF v5.2.7 добавлена возможность сохранять опции в записи.
Если вы используете сохранение опций в запись, то не используйте в " 178 | "именах полей приставку _acfop_." 179 | 180 | #: options-pages.php:406 options-pages.php:774 options-pages.php:788 181 | msgid "Options" 182 | msgstr "Опции" 183 | 184 | #: options-pages.php:407 185 | msgid "Post Object" 186 | msgstr "Выбрать запись" 187 | 188 | #: options-pages.php:408 options-pages.php:778 options-pages.php:790 189 | msgid "This Post" 190 | msgstr "Эта запись" 191 | 192 | #: options-pages.php:417 193 | msgid "Post/Page" 194 | msgstr "Запись \\ Страница" 195 | 196 | #: options-pages.php:420 197 | msgid "Select the post object to save and load data to/from." 198 | msgstr "Выберите страницу или запись для сохранения в нее настроек." 199 | 200 | #: options-pages.php:447 201 | msgid "Autoload Values" 202 | msgstr "Автозагрузка опций" 203 | 204 | #: options-pages.php:453 205 | msgid "" 206 | "Whether to load the options (values saved from this options page) when " 207 | "WordPress starts up. Added in ACF v5.2.8." 208 | msgstr "Загружать эти опции по умолчанию при загрузке Wordpress." 209 | 210 | #: options-pages.php:468 211 | msgid "Customize" 212 | msgstr "Подписи сверху и снизу" 213 | 214 | #: options-pages.php:484 215 | msgid "Header Content" 216 | msgstr "Текст сверху" 217 | 218 | #: options-pages.php:487 219 | msgid "" 220 | "Content will be added to the options page header after the Options Page " 221 | "Title." 222 | msgstr "Текст из этого блока будет добавлен вверху страницы настройки." 223 | 224 | #: options-pages.php:503 225 | msgid "Footer Content" 226 | msgstr "Текст снизу" 227 | 228 | #: options-pages.php:506 229 | msgid "" 230 | "Content will be added to the options page footer after all ACF Field Groups." 231 | msgstr "Текст из этого блока будет добавлен внизу страницы настройки." 232 | 233 | #: options-pages.php:744 234 | msgid "Post ID" 235 | msgstr "ID записи" 236 | 237 | #: options-pages.php:747 238 | msgid "Location (Parent)" 239 | msgstr "Расположение (Родитель)" 240 | 241 | #: options-pages.php:752 242 | msgid "Hook Suffix" 243 | msgstr "Суффикс для хука" 244 | 245 | #: options-pages.php:776 options-pages.php:792 246 | msgid "Post" 247 | msgstr "Запись" 248 | 249 | #: options-pages.php:786 250 | msgid "1st sub option page value
OR
" 251 | msgstr "Значение 1й вложенной страницы
ИЛИ
" 252 | 253 | #: options-pages.php:862 254 | msgid "None" 255 | msgstr "Не выбрано" 256 | 257 | #: options-pages.php:939 options-pages.php:954 options-pages.php:956 258 | msgid "Options Pages" 259 | msgstr "Страницы опций" 260 | 261 | #: options-pages.php:955 262 | msgid "Options Page" 263 | msgstr "Страница опций" 264 | 265 | #: options-pages.php:957 266 | msgid "Add Options Page" 267 | msgstr "Добавить страницу опций" 268 | 269 | #: options-pages.php:958 270 | msgid "Add New Options Page" 271 | msgstr "Добавление страницы опций..." 272 | 273 | #: options-pages.php:959 274 | msgid "Edit" 275 | msgstr "Редактировать" 276 | 277 | #: options-pages.php:960 278 | msgid "Edit Options Page" 279 | msgstr "Редактировать страницу опций" 280 | 281 | #: options-pages.php:961 282 | msgid "New Options Page" 283 | msgstr "Новая страница опций" 284 | 285 | #: options-pages.php:962 options-pages.php:963 286 | msgid "View Options Page" 287 | msgstr "Просмотреть" 288 | 289 | #: options-pages.php:964 290 | msgid "Search Options Pages" 291 | msgstr "Найти" 292 | 293 | #: options-pages.php:965 294 | msgid "No Options Pages Found" 295 | msgstr "Ничего не найдено" 296 | 297 | #: options-pages.php:966 298 | msgid "No Options Pages Found in Trash" 299 | msgstr "Ничего не найдено" 300 | 301 | #: options-pages.php:967 302 | msgid "Parent Options Page" 303 | msgstr "Родительская страница опций" 304 | 305 | #: options-pages.php:1030 306 | msgid "Plugins by John Huebner" 307 | msgstr "Автор плагина: John Huebner" 308 | 309 | #: options-pages.php:1047 310 | msgid "Thank you for using my plugins" 311 | msgstr "Спасибо, за то, что используете мой плагин." 312 | 313 | #: options-pages.php:1056 314 | msgid "Documentation" 315 | msgstr "Документация" 316 | 317 | #: options-pages.php:1064 318 | msgid "Please consider making a small donation." 319 | msgstr "" 320 | "Если вам понравился данный плагин, вы можете сделать небольшое пожертвование." 321 | 322 | #~ msgid "" 323 | #~ "ACF v5.2.7 added the ability to save and load data to/from a post rather " 324 | #~ "than options.

When saving values to this post do not use " 325 | #~ "field names in your field groups that start with _acfop_." 326 | #~ msgstr "" 327 | #~ "Вы можете сохранять настройки полей в определенную запись. Если вы это " 328 | #~ "делаете не используйте в названии груп полей словосочетание _acfop_ в " 329 | #~ "начале названия." 330 | 331 | #~ msgid "Post " 332 | #~ msgstr "Запись" 333 | 334 | #~ msgid "" 335 | #~ "If set to true, this options page will redirect to the first child page " 336 | #~ "(if a child page exists). If set to false, this parent page will appear " 337 | #~ "alongside any child pages. Defaults to true.
NOTE: " 338 | #~ "Changing this setting will effect the location or appearance of sub " 339 | #~ "options pages currently associated with this options page." 340 | #~ msgstr "" 341 | #~ "Если установить данный параметр, то будет происходит перенаправление на " 342 | #~ "первый пункт вложенного меню." 343 | 344 | #~ msgid "True" 345 | #~ msgstr "Да" 346 | 347 | #~ msgid "False" 348 | #~ msgstr "Нет" 349 | 350 | #~ msgid "" 351 | #~ "Allows easy creation of options pages using Advanced Custom Fields Pro " 352 | #~ "without needing to do any PHP coding. Requires that ACF Pro is installed." 353 | #~ msgstr "" 354 | #~ "Создание страниц опций для плагина Advanced Custom Fields Pro без " 355 | #~ "использования PHP. Требуется про-версия плагина ACF." 356 | -------------------------------------------------------------------------------- /lang/acf-options-page-adder-pt_PT.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: ACF Options Page Adder\n" 6 | "Report-Msgid-Bugs-To: Translator Name \n" 7 | "POT-Creation-Date: 2017-04-14 13:24+0100\n" 8 | "PO-Revision-Date: 2017-04-14 15:14+0100\n" 9 | "Last-Translator: Pedro Mendonça \n" 10 | "Language-Team: Pedro Mendonça \n" 11 | "Language: pt_PT\n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 16 | "X-Generator: Poedit 2.0.1\n" 17 | "X-Poedit-SourceCharset: UTF-8\n" 18 | "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 19 | "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;" 20 | "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" 21 | "X-Textdomain-Support: yes\n" 22 | "X-Poedit-Basepath: ..\n" 23 | "X-Poedit-WPHeader: options-pages.php\n" 24 | "X-Poedit-SearchPath-0: .\n" 25 | "X-Poedit-SearchPathExcluded-0: *.js\n" 26 | 27 | #. Plugin Name of the plugin/theme 28 | #: options-pages.php:157 29 | msgid "ACF Options Page Admin" 30 | msgstr "ACF Options Page Admin" 31 | 32 | #: options-pages.php:196 33 | msgid "Options Page Details" 34 | msgstr "Detalhes da página de opções" 35 | 36 | #: options-pages.php:200 37 | msgid "Basic Settings" 38 | msgstr "Definições básicas" 39 | 40 | #: options-pages.php:216 41 | msgid "Title Text" 42 | msgstr "Texto do título" 43 | 44 | #: options-pages.php:220 45 | msgid "This will be used as the options page title." 46 | msgstr "Isto será usado como título da página de opções." 47 | 48 | #: options-pages.php:233 options-pages.php:819 49 | msgid "Menu Text" 50 | msgstr "Texto do menu" 51 | 52 | #: options-pages.php:237 53 | msgid "Will default to title if left blank." 54 | msgstr "Por omissão será usado o título." 55 | 56 | #: options-pages.php:250 57 | msgid "Menu Location (Parent)" 58 | msgstr "Localização no menu (Superior)" 59 | 60 | #: options-pages.php:254 61 | msgid "" 62 | "Select the menu this options page will appear under. Will default to None." 63 | msgstr "" 64 | "Seleccione o menu onde a página de opções deverá ser incluída. Por omissão é " 65 | "nenhum." 66 | 67 | #: options-pages.php:269 options-pages.php:820 68 | msgid "Slug" 69 | msgstr "Slug" 70 | 71 | #: options-pages.php:273 72 | msgid "" 73 | "This field is optional in ACF. It is required here. You must know what the " 74 | "slug is to enable get_options_page_post_id() added in 4.4.0" 75 | msgstr "" 76 | "Este campo é opcional no ACF. Aqui é obrigatório. Tem de saber qual é a slug " 77 | "para permitir a função get_options_page_post_id() adicionada na v4.4.0." 78 | 79 | #: options-pages.php:286 options-pages.php:824 80 | msgid "Order" 81 | msgstr "Ordem" 82 | 83 | #: options-pages.php:290 84 | msgid "The order that this child menu should appear under its parent menu." 85 | msgstr "A ordem em que este submenu deverá ficar dentro do seu menu superior." 86 | 87 | #: options-pages.php:311 88 | msgid "Advanced Settings" 89 | msgstr "Definições avançadas" 90 | 91 | #: options-pages.php:327 options-pages.php:825 92 | msgid "Capability" 93 | msgstr "Capacidade" 94 | 95 | #: options-pages.php:331 96 | msgid "" 97 | "The user capability to view this options page. Will default to " 98 | "manage_options." 99 | msgstr "" 100 | "A capacidade do utilizador para ver esta página de opções. Por omissão é " 101 | "manage_options." 102 | 103 | #: options-pages.php:346 104 | msgid "Menu Position" 105 | msgstr "Posição no menu" 106 | 107 | #: options-pages.php:350 108 | msgid "" 109 | "The position in the menu order this menu should appear. WARNING: if two menu " 110 | "items use the same position attribute, one of the items may be overwritten " 111 | "so that only one item displays! Risk of conflict can be reduced by using " 112 | "decimal instead of integer values, e.g. 63.3 instead of 63. Defaults to " 113 | "bottom of utility menu items.
Core Menu Item Positions: " 114 | "2=Dashboard, 4=Separator, 5=Posts, 10=Media, 15=Links, 20=Pages, " 115 | "25=Comments, 59=Separator, 60=Appearance, 65=Plugins, 70=Users, 75=Tools, " 116 | "80=Settings, 99=Separator" 117 | msgstr "" 118 | "A posição em que este menu deverá aparecer. AVISO: Se dois itens de menu " 119 | "usarem o mesmo atributo de posição, um dos itens poderá ser substituído e só " 120 | "um será mostrado! O risco de conflito será reduzido se usar números decimais " 121 | "em vez de inteiros, por exemplo 63.3 em vez de 63. Por omissão será abaixo " 122 | "dos itens de menu principais.
Posições de itens de menu do core: " 123 | "2=Painel, 4=Separador, 5=Artigos, 10=Multimédia, 15=Ligações, 20=Páginas, " 124 | "25=Comentários, 59=Separador, 60=Apresentação, 65=Plugins, 70=Utilizadores, " 125 | "75=Ferramentas, 80=Opções, 99=Separador" 126 | 127 | #: options-pages.php:373 128 | msgid "Icon" 129 | msgstr "Ícone" 130 | 131 | #: options-pages.php:377 132 | msgid "" 133 | "The icon url for this menu. Defaults to default WordPress gear.
Check out https://developer.wordpress.org/resource/dashicons/ " 136 | "for what to put in this field." 137 | msgstr "" 138 | "O URL do ícone para este menu. Por omissão é a roda dentada do WordPress." 139 | "
Veja os https://developer.wordpress.org/resource/" 141 | "dashicons/ que pode inserir neste campo." 142 | 143 | #: options-pages.php:398 options-pages.php:822 144 | msgid "Redirect" 145 | msgstr "Redireccionar" 146 | 147 | #: options-pages.php:402 options-pages.php:476 options-pages.php:513 148 | #: options-pages.php:923 149 | msgid "Yes" 150 | msgstr "Sim" 151 | 152 | #: options-pages.php:403 options-pages.php:477 options-pages.php:514 153 | #: options-pages.php:925 154 | msgid "No" 155 | msgstr "Não" 156 | 157 | #: options-pages.php:404 158 | msgid "" 159 | "If set to Yes, this options page will redirect to the first child page (if a " 160 | "child page exists). If set to No, this parent page will appear alongside any " 161 | "child pages. Defaults to Yes.
NOTE: Changing this setting " 162 | "will effect the location or appearance of sub options pages currently " 163 | "associated with this options page." 164 | msgstr "" 165 | "Se activar o redireccionamento, esta página de opções será redireccionada " 166 | "para a primeira página dependente, caso exista. Se optar por não " 167 | "redireccionar, esta página superior será mostrada tal como qualquer página " 168 | "dependente. Por omissão é Sim.
ATENÇÃO: Alterar esta " 169 | "definição irá afectar a localização ou apresentação de páginas dependentes " 170 | "actualmente associadas a esta página de opções." 171 | 172 | #: options-pages.php:419 options-pages.php:823 173 | msgid "Save To" 174 | msgstr "Guardar para" 175 | 176 | #: options-pages.php:422 177 | msgid "" 178 | "ACF v5.2.7 added the ability to save and load data to/from a post rather " 179 | "than options.
When saving values to this post do not use field " 180 | "names in your field groups that start with _acfop_." 181 | msgstr "" 182 | "O ACF v5.2.7 adicionou a possibilidade de guardar e carregar dados num " 183 | "conteúdo em vez de opções.
Ao guardar valores para este conteúdo, " 184 | "não utilize nomes de campos nos seus grupos de campos que comecem com " 185 | "_acfop_." 186 | 187 | #: options-pages.php:431 options-pages.php:848 options-pages.php:862 188 | msgid "Options" 189 | msgstr "Opções" 190 | 191 | #: options-pages.php:432 192 | msgid "Post Object" 193 | msgstr "Conteúdo" 194 | 195 | #: options-pages.php:433 options-pages.php:852 options-pages.php:864 196 | msgid "This Post" 197 | msgstr "Este conteúdo" 198 | 199 | #: options-pages.php:442 200 | msgid "Post/Page" 201 | msgstr "Conteúdo/Página" 202 | 203 | #: options-pages.php:445 204 | msgid "Select the post object to save and load data to/from." 205 | msgstr "Seleccione o conteúdo para onde guardar e de onde carregar dados." 206 | 207 | #: options-pages.php:472 208 | msgid "Autoload Values" 209 | msgstr "Carregar valores automaticamente" 210 | 211 | #: options-pages.php:478 212 | msgid "" 213 | "Whether to load the options (values saved from this options page) when " 214 | "WordPress starts up. Added in ACF v5.2.8." 215 | msgstr "" 216 | "Se deve ou não carregar as opções (valores guardados através desta página de " 217 | "opções) ao carregar o WordPress. Adicionado no ACF v5.2.8." 218 | 219 | #: options-pages.php:493 220 | msgid "Customize" 221 | msgstr "Personalizar" 222 | 223 | #: options-pages.php:509 224 | msgid "Customization" 225 | msgstr "Personalização" 226 | 227 | #: options-pages.php:515 228 | msgid "" 229 | "Turning this on will allow you to add header and footer content to the " 230 | "options page
WARNING: On options " 231 | "page with a large number of fields this feature can cause the loading of the " 232 | "options page to cause an out of memory fatal error. This feature should not " 233 | "be used on options pages that may have large numbers of fields to display. " 234 | "If this feature is off it will disable not only the content editors here but " 235 | "also will disable the filters mentioned in the documentation." 236 | msgstr "" 237 | "Se ligar esta opção, permitirá adicionar conteúdo ao cabeçalho e rodapé da " 238 | "sua página de opções.
AVISO: Em " 239 | "páginas de opções com uma grande quantidade de campos, esta funcionalidade " 240 | "poderá causar um erro fatal de memória ao carregar a página de opções. Esta " 241 | "funcionalidade não deverá ser usada em páginas de opções que mostrem uma " 242 | "grande quantidade de campos. Se esta funcionalidade estiver desligada, " 243 | "desactivará não só os editores de conteúdo mas também os filtros mencionados " 244 | "na documentação." 245 | 246 | #: options-pages.php:516 247 | msgid "Allow Customization of Header & Footer?" 248 | msgstr "Permitir a personalização do cabeçalho e do rodapé?" 249 | 250 | #: options-pages.php:523 251 | msgid "Header Content" 252 | msgstr "Conteúdo do cabeçalho" 253 | 254 | #: options-pages.php:526 255 | msgid "" 256 | "Content will be added to the options page header after the Options Page " 257 | "Title." 258 | msgstr "" 259 | "O conteúdo será adicionado ao cabeçalho da página de opções, depois do " 260 | "título da página de opções." 261 | 262 | #: options-pages.php:550 263 | msgid "Footer Content" 264 | msgstr "Conteúdo do rodapé" 265 | 266 | #: options-pages.php:553 267 | msgid "" 268 | "Content will be added to the options page footer after all ACF Field Groups." 269 | msgstr "" 270 | "O conteúdo será adicionado ao rodapé da página de opções, depois de todos os " 271 | "grupos de campos do ACF." 272 | 273 | #: options-pages.php:818 274 | msgid "Post ID" 275 | msgstr "ID do conteúdo" 276 | 277 | #: options-pages.php:821 278 | msgid "Location (Parent)" 279 | msgstr "Localização (Superior)" 280 | 281 | #: options-pages.php:826 282 | msgid "Hook Suffix" 283 | msgstr "Sufixo do hook" 284 | 285 | #: options-pages.php:850 options-pages.php:866 286 | msgid "Post" 287 | msgstr "Conteúdo" 288 | 289 | #: options-pages.php:860 290 | msgid "1st sub option page value
OR
" 291 | msgstr "Valor da 1ª página dependente
OU
" 292 | 293 | #: options-pages.php:936 294 | msgid "None" 295 | msgstr "Nenhum" 296 | 297 | #: options-pages.php:1013 options-pages.php:1028 options-pages.php:1030 298 | msgid "Options Pages" 299 | msgstr "Páginas de opções" 300 | 301 | #: options-pages.php:1029 302 | msgid "Options Page" 303 | msgstr "Página de opções" 304 | 305 | #: options-pages.php:1031 306 | msgid "Add Options Page" 307 | msgstr "Adicionar página de opções" 308 | 309 | #: options-pages.php:1032 310 | msgid "Add New Options Page" 311 | msgstr "Adicionar nova página de opções" 312 | 313 | #: options-pages.php:1033 314 | msgid "Edit" 315 | msgstr "Editar" 316 | 317 | #: options-pages.php:1034 318 | msgid "Edit Options Page" 319 | msgstr "Editar página de opções" 320 | 321 | #: options-pages.php:1035 322 | msgid "New Options Page" 323 | msgstr "Nova página de opções" 324 | 325 | #: options-pages.php:1036 options-pages.php:1037 326 | msgid "View Options Page" 327 | msgstr "Ver página de opções" 328 | 329 | #: options-pages.php:1038 330 | msgid "Search Options Pages" 331 | msgstr "Pesquisar páginas de opções" 332 | 333 | #: options-pages.php:1039 334 | msgid "No Options Pages Found" 335 | msgstr "Nenhuma página de opções encontrada" 336 | 337 | #: options-pages.php:1040 338 | msgid "No Options Pages Found in Trash" 339 | msgstr "Nenhuma página de opções encontrada no lixo" 340 | 341 | #: options-pages.php:1041 342 | msgid "Parent Options Page" 343 | msgstr "Página de opções superior" 344 | 345 | #: options-pages.php:1104 346 | msgid "Plugins by John Huebner" 347 | msgstr "Plugins de John Huebner" 348 | 349 | #: options-pages.php:1121 350 | msgid "Thank you for using my plugins" 351 | msgstr "Obrigado por usar os meus plugins" 352 | 353 | #: options-pages.php:1130 354 | msgid "Documentation" 355 | msgstr "Documentação" 356 | 357 | #: options-pages.php:1138 358 | msgid "Please consider making a small donation." 359 | msgstr "Por favor, considere fazer um pequeno donativo." 360 | 361 | #. Plugin URI of the plugin/theme 362 | msgid "https://wordpress.org/plugins/options-page-admin-for-acf/" 363 | msgstr "https://wordpress.org/plugins/options-page-admin-for-acf/" 364 | 365 | #. Description of the plugin/theme 366 | msgid "" 367 | "Allows easy creation of options pages using Advanced Custom Fields Pro " 368 | "without needing to do any PHP coding. Requires that ACF Pro is installed." 369 | msgstr "" 370 | "Permite facilmente criar páginas de opções usando Advanced Custom Fields Pro " 371 | "sem precisar de programar em PHP. Requer que o ACF Pro esteja instalado." 372 | 373 | #. Author of the plugin/theme 374 | msgid "John A. Huebner II" 375 | msgstr "John A. Huebner II" 376 | 377 | #. Author URI of the plugin/theme 378 | msgid "https://github.com/Hube2" 379 | msgstr "https://github.com/Hube2" 380 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === ACF Options Page Admin === 2 | Contributors: Hube2 3 | Tags: Options Page, ACF 4 | Requires at least: 3.5 5 | Tested up to: 5.7 6 | Stable tag: 3.10.0 7 | Donate link: 8 | License: 9 | License URI: 10 | 11 | Allows easy creation of options pages using Advanced Custom Fields Pro without needing to do any PHP coding. Requires that ACF5 Pro is installed (or ACF5 + Options Page Add On) 12 | 13 | == Description == 14 | 15 | *** New feature added: Custom Post ID Slugs *** 16 | 17 | This is an add on plugin for Advanced Custom Fields (ACF) 5 + the Options Page Add On (or ACF Pro). 18 | ***This plugin will not provide any functionality unless ACF 5 and the Options Page Add On (or ACF5 Pro) 19 | is installed*** 20 | 21 | This plugin provides an admin interface for adding options pages in ACF including all options for ACF 22 | options pages. Most options are selectable, for example the menu location, capability and where to save 23 | field values to. 24 | 25 | For more information see 26 | [Other Notes](https://wordpress.org/plugins/options-page-admin-for-acf/other_notes/) and 27 | [Screenshots](https://wordpress.org/plugins/options-page-admin-for-acf/screenshots/) 28 | 29 | == Installation == 30 | 31 | 1. Extract files to folder named acf-options-page-adder in your plugin folder (usually /wp-content/plugins/options-page-admin-for-acf/) 32 | 2. Upload files 33 | 3. Activate it from the Plugins Page 34 | 35 | 36 | == Screenshots == 37 | 38 | 1. Options Page Admin List 39 | 2. Options Page Basic Settings 40 | 3. Options Sub Page Basic Settings 41 | 4. Options Page Advanced Settings 42 | 5. Options Sub Page Advanced Settings 43 | 6. Options Page Content Customization 44 | 45 | == Frequently Asked Questions == 46 | 47 | None Yet 48 | 49 | == Other Notes == 50 | 51 | == Github Repository == 52 | 53 | This plugin is also on GitHub 54 | [https://github.com/Hube2/acf-options-page-adder](https://github.com/Hube2/acf-options-page-adder) 55 | 56 | == Change Capability == 57 | 58 | The capability required to add/edit options page settings is "manage_options". This capability can be changed by adding a filter. 59 | ` 60 | add_filter('acf-options-page-adder/capability', 'my_acf_options_page_adder_cap'); 61 | function my_acf_options_page_adder_cap($cap) { 62 | $cap = 'edit_published_posts'; 63 | return $cap; 64 | } 65 | ` 66 | 67 | == Saving Values to the Options Page Post == 68 | 69 | ACF v5.2.7 added the ability to save options page fields to a post ID. This plugin will let you save the options to the same post ID of the post created when adding an options page using this plugin. You can even use get_fields($options_page_id) without needing to worry about getting the fields for the options page itself. Why? because all the fields used for creating the options page start with an underscore _ and will not be returned by get_fields(). The only thing you need to be careful of is not using any of the field names used by this plugin, which should be extremely easy since they all start with _acfop_. 70 | 71 | == Saving Values Using a Custom post ID slug == 72 | It is posible to use a custom slug for saving options page values. For example, if you wanted to save values of an options page to a user you could supply "user_1" as the $post_id value for the opitons page. This also has another side effect. Normally, when ACF saves values to "options" in the options table you will find the fields with the "options_" prefix. So for example, if your field name is "my_field" then in the options table you will find "options_my_field" as the options name. You can supply a custom slug for this, let's say that you set the post ID setting for the options page to "my-custom-slug". this would cause the same field in the options page to have the name "my-custom-slug_my_field". 2 New options have been added to this plugin and you can choose to use the options page slug for the post ID or you can specify a custom slug to use instead. 73 | 74 | == Get Post ID for Options Page == 75 | 76 | A function and a filter are available for getting the correct ACF $post_id value to use for getting 77 | values from the options page. This function/filter will return 'options' for options pages stored in 78 | options or will return the correct post ID if options are saved to a post. The correct ID is returned 79 | based on the "menu_slug" value of the options page. 80 | 81 | ` 82 | / example 1: function get_options_page_id() 83 | 84 | // get the post_id of an options page 85 | $post_id = get_options_page_id('my_options_page_slug'); 86 | // get a value using $post_id 87 | $value = get_field('my_option_field', $post_id); 88 | 89 | // or it can be combined like this 90 | $value = get_field('my_option_field', get_options_page_id('my_options_page_slug')); 91 | ` 92 | 93 | ` 94 | // example 2: by filter 95 | $default = 'option', 96 | $slug = 'my_options_page_slug'; 97 | $post_id = apply_filters('get_option_page_id_filter', $default, $slug); 98 | $value = get_field('my_option_field', $post_id); 99 | 100 | // or it can be combined like this 101 | $value = get_field('my_option_field', apply_filters('get_option_page_id_filter', $default, $slug)); 102 | ` 103 | 104 | *There is a condition where you will get the incorrect post id. This condition is created by having a top level redirect page that is set to redirect to the first sub options page. If there is no sub options page that exists then it will return the value for the top level options page. If you later create a sub options page it will return the new value from the sub options page. This is why I have see the default value of redirect to false. If you want the top level page to redirect the you need to be aware that it can cause you issues later down the road if you haven't created a sub option page. You should also specifically set the order of sub options pages so that these do not change at some point in the future because adding a new options page with the same order as the existing top level page will alter the save and get location to the new options page. There's noting I can do about this, it the way it works. When setting up ACF options pages to save to a post instead of options you must be more precise in with the options page arguments.* 105 | 106 | == Font Awesome Support == 107 | 108 | Please note that this plugin does not enqueue or include Font Awswsome in the admin of your site. 109 | If you include Font Awsome in your admin then you can use Font Awesome Icons for the icons of 110 | top level options page. For example if you wanted to use [Address Book Icon](http://fontawesome.io/icon/address-book/) then all you need to do is add `fa fa-address-book` 111 | into the Icon field when adding or editing the options page. 112 | 113 | == Filter Options Page Header/Footer/Content == 114 | 115 | Version 3.8.0 of this plugin added the ability to customize the ACF options page by adding header and footer content. In addtion to the WYSIWYG fields that have been added to the options page admin editor you can also customize these sections, or the entire options page using filters. 116 | 117 | Version 3.8.2 of this plugin adds a toggle to enable this feature. This feature can cause an out of 118 | memory fatal error on options pages that have large numbers of fields. If content was entered into this field before the toggle to turn in on then the toggle will be automatically turned on. Otherwise the default for this option will be off. 119 | 120 | **Header Content** 121 | 122 | ` 123 | add_filter('acf-options-page-adder/page-header', 'my_custom_options_page_header', 10, 2); 124 | 125 | function my_custom_options_page_header($content, $hook) { 126 | // $content = content, by default it is '' or the value of the WYSIWYG editor 127 | // $hook = the current options page hook that is being called 128 | $content = '

My Custom Header Content

'; 129 | return $content; 130 | } 131 | ` 132 | 133 | **Footer Content** 134 | 135 | ` 136 | add_filter('acf-options-page-adder/page-footer', 'my_custom_options_page_footer', 10, 2); 137 | 138 | function my_custom_options_page_footer($content, $hook) { 139 | // $content = content, by default it is '' or the value of the WYSIWYG editor 140 | // $hook = the current options page hook that is being called 141 | $content = '

My Custom Footer Content

'; 142 | return $content; 143 | } 144 | ` 145 | 146 | **Filter Entire Options Page** 147 | 148 | ` 149 | add_filter('acf-options-page-adder/page-content', 'my_custom_options_page_filter', 10, 2); 150 | 151 | function my_custom_options_page_filter($content, $hook) { 152 | // $content = entire content or options page, including all ACF fields 153 | // $hook = the current options page hook that is being called 154 | // caution should be taken when making modification to the page content 155 | return $content; 156 | } 157 | ` 158 | 159 | == Remove Nag == 160 | 161 | If you would like to remove my little nag that appears on some admin pages add the following to your functions.php file 162 | ` 163 | add_filter('remove_hube2_nag', '__return_true'); 164 | ` 165 | 166 | 167 | == Changelog == 168 | 169 | = 3.10.0 = 170 | * added GraphQL schema support 171 | 172 | = 3.9.6 = 173 | * disable all functionality if acf options page functions do not exist 174 | 175 | = 3.9.5 = 176 | * moved acf/include_fields to __construct due to change is ACF timing 177 | 178 | = 3.9.4 = 179 | * removed bug introduced in 3.9.3 (post id shown) 180 | 181 | = 3.9.3 = 182 | * corrected bugs in options page custimizations 183 | 184 | = 3.9.2 = 185 | * recommit of 3.9.1 because it didn't take for some reason 186 | 187 | = 3.9.1 = 188 | * corrected bug/error when installed and not acf options pages active 189 | 190 | = 3.9.0 = 191 | * adjusted post type to ensure disabling glutenberg 192 | * removed donation nag 193 | * added slug options for saving fields to custom slugs 194 | 195 | = 3.8.9 = 196 | * Fixed bug in setting parent options page 197 | * Corrected display of were fields will be saved 198 | * Corrected all translation calls to not use variable for text domain 199 | * Corrected bug in get_option_page_id() for redirected parent pages 200 | * Minor text changes 201 | 202 | = 3.8.8 = 203 | * Increased init priority to prevent interferance with some poorly written plugins that alter queries without proper checking to make sure the query is for the correct post type. 204 | 205 | = 3.8.7 = 206 | * Removed admin/ajax check added in last update. Change in ACF caused options pages not to appear when generated by AJAX. 207 | 208 | = 3.8.6 = 209 | * corrected issue where options page query done on init can interfere with operation of other plugins. Disable option page setup when on front end and when doing ajax as this setup is not needed here. Removing this query at these times should also improve site performance. 210 | 211 | = 3.8.5 = 212 | * removed ACF from disallowed parent parent menus 213 | 214 | = 3.8.4 = 215 | * translation updates 216 | 217 | = 3.8.3 = 218 | * correcting some minor issues/erros introduced in 3.8.2 219 | 220 | = 3.8.2 = 221 | * added toggle to turn customize features on/off 222 | 223 | = 3.8.1 = 224 | * corrected bug in menu position 225 | * corrected bug in hook setting 226 | 227 | = 3.8.0 = 228 | * replaced register_field_group() call with acf_add_local_field_group() - #41 229 | * added tabs for basic/advanced settings 230 | * added page content customization options + new filters - #40 231 | * added performance optimization - #42 232 | * added internal correction for attaching files - #39 233 | * minor modifications 234 | 235 | = 3.7.5 = 236 | * more updates to Russian translation [@antonvyukov](https://wordpress.org/support/users/antonvyukov/) 237 | 238 | = 3.7.4 = 239 | * updated Russian translation [@antonvyukov](https://wordpress.org/support/users/antonvyukov/) 240 | 241 | = 3.7.3 = 242 | * added more missing text domains 243 | * completed adding Portuguese (pt_PT) translation 244 | * converted True/False radio fields to ACF true/false UI fields 245 | * added Russian (ru_RU) translations - thanks [@antonvyukov](https://wordpress.org/support/users/antonvyukov/) 246 | 247 | = 3.7.2 = 248 | * Added missing text domain 249 | * Typos corrected 250 | * Add Portuguese (pt_PT) translation - thanks [@pedro-mendonca](https://wordpress.org/support/users/pedromendonca) 251 | 252 | = 3.7.1 = 253 | * removed github updater support 254 | 255 | = 3.7.0 = 256 | * Added support for Font Awesome icons [See Other Notes](https://wordpress.org/plugins/options-page-admin-for-acf/other_notes/) 257 | 258 | = 3.6.1 = 259 | * First release to wordpress.org 260 | 261 | = 3.6.0 = 262 | * Added filter to use page tiles instead of menu title for location setting when editing ACF field group 263 | * Corrected some bugs 264 | * Removed fieldset duplicator 265 | 266 | = 3.5.3 = 267 | * correction to when filter is added to prevent multiple additions of filter 268 | 269 | = 3.5.2 = 270 | * ? 271 | 272 | = 3.5.1 = 273 | * fixed bug, titles being removed from all other post types 274 | 275 | = 3.5.0 = 276 | * Changed default redirect value to false 277 | * Added admin column for "Save To" 278 | * Added function get_option_page_id() and get_options_page_id() 279 | 280 | = 3.4.0 = 281 | * removed post title 282 | * added required title field 283 | * slug field now required 284 | * added validation to slug field 285 | * removed no longer needed message field about post title 286 | * updated instructions and messages for several fields 287 | 288 | = 3.3.0 = 289 | * changed capability to "manage_options" 290 | * added filter to allow changing of capability 291 | 292 | = 3.2.1 = 293 | * corrected conditional logic on slug field 294 | 295 | = 3.2.0 = 296 | * added remove nag filter 297 | 298 | = 3.1.6 = 299 | * corrected white-space error 300 | 301 | = 3.1.5 = 302 | * added donation box 303 | 304 | = 3.1.4 = 305 | * added support for github updater 306 | 307 | = 3.1.3 == 308 | * Removed comment from field group duplicator 309 | 310 | = 3.1.2 = 311 | * Corrects Issue #17 312 | 313 | = 3.1.1 = 314 | * Added checks to ensure that ACF5 Pro is installed and active 315 | 316 | = 3.1.0 = 317 | * Corrected bug, duplicated field groups not showing on options pages 318 | * Added support for save/loading to/from post objects added in ACF v5.2.7 319 | 320 | = 3.0.0 = 321 | * Added support for autoload option added in ACF v5.2.8 322 | 323 | = 2.2.0 = 324 | * Added field group duplicator 325 | 326 | = 2.1.0 = 327 | * Added support for redirect 328 | * Added support for menu position 329 | * Added support for icon (dashicons) 330 | * Added sorting of sub options pages 331 | 332 | = 2.0.0 = 333 | * Corrected bug in adding top level option page 334 | * Corrected bug in display of location 335 | * Corrected bug in options page slugs not being saved correctly 336 | * Removed support for ACF4 337 | * Changed default value of location to "None" 338 | 339 | = 1.1.1 = 340 | * Removed $post global in function admin_columns_content(), not needed, post_id is passed by hook. 341 | * Added code to prevent plugin from running if not included by WP. 342 | * Reworked function acf_add_options_sub_page() to not use have_posts() function so it's less likely to interfere with other queries. 343 | * Other minor code changes that don't effect operation 344 | 345 | = 1.1.0 = 346 | * Updated to be compatable with ACF-Pro (continues to work on ACF4) 347 | 348 | = 1.0.0 = 349 | * Initial Stable Version 350 | 351 | = 0.0.1 = 352 | * initial release 353 | 354 | == Upgrade Notice == 355 | -------------------------------------------------------------------------------- /options-pages.php: -------------------------------------------------------------------------------- 1 | post_type || 57 | !isset($this->options_pages[$id])) { 58 | return $allcaps; 59 | } 60 | remove_filter('user_has_cap', array($this, 'attach_files'), 10); 61 | 62 | $page = $this->options_pages[$id]; 63 | $cap = $page['acf']['capability']; 64 | if (current_user_can($cap)) { 65 | // add all $caps to $allcaps 66 | foreach ($caps as $add) { 67 | $allcaps[$add] = true; 68 | } 69 | } 70 | add_filter('user_has_cap', array($this, 'attach_files'), 10, 4); 71 | return $allcaps; 72 | } // end public function attach_files 73 | 74 | public function script() { 75 | $handle = 'acf-options-page-adder'; 76 | $src = plugin_dir_url(__FILE__).'options-pages.js'; 77 | $deps = array('jquery'); 78 | $ver = $this->version; 79 | $in_footer = false; 80 | wp_enqueue_script($handle, $src, $deps, $ver, $in_footer); 81 | } // end public function script 82 | 83 | public function options_page_rule_values_titles($choices) { 84 | if (!apply_filters('acf-options-page-adder/choice_titles', true)) { 85 | return $choices; 86 | } 87 | $pages = acf_get_options_pages(); 88 | if (!$pages) { 89 | return $choices; 90 | } 91 | foreach ($pages as $page) { 92 | $choices[$page['menu_slug']] = $page['page_title']; 93 | } 94 | return $choices; 95 | } // end public function options_page_rule_values_titles 96 | 97 | public function set_page_slug_field($value, $post_id, $field) { 98 | if (!empty($value)) { 99 | return $value; 100 | } 101 | // options page was created before the title field was added 102 | $slug = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', get_the_title($post_id)), '-')); 103 | if ($slug != 'auto-draft') { 104 | $value = $slug; 105 | } 106 | return $value; 107 | } // end public function set_page_slug_field 108 | 109 | public function slug_characters($valid, $value, $post_id, $field) { 110 | // only allow leters, number, underscores, dashes 111 | if (!$valid) { 112 | return $valid; 113 | } 114 | if (!preg_match('/^[a-z]/i', $value) || preg_match('/[^-_0-9a-z]/i', $value)) { 115 | return $field['label'].' '.__('must begin with a letter and include only numbers, letters, underscores and hyphens', 'acf-options-page-adder'); 116 | } 117 | return $valid; 118 | } // end public function slug_characters 119 | 120 | public function unique_value($valid, $value, $field, $input) { 121 | // must be unique 122 | if (!$valid || (!isset($_POST['post_id']) && !isset($_POST['post_ID']))) { 123 | return $valid; 124 | } 125 | if (isset($_POST['post_id'])) { 126 | $post_id = intval($_POST['post_id']); 127 | } else { 128 | $post_id = intval($_POST['post_ID']); 129 | } 130 | if (!$post_id) { 131 | return $valid; 132 | } 133 | $post_type = get_post_type($post_id); 134 | $field_name = $field['name']; 135 | $args = array( 136 | 'post_type' => $post_type, 137 | 'post_status' => 'publish, draft, trash', 138 | 'post__not_in' => array($post_id), 139 | 'meta_query' => array( 140 | array( 141 | 'key' => $field_name, 142 | 'value' => $value 143 | ) 144 | ) 145 | ); 146 | $query = new WP_Query($args); 147 | if (count($query->posts)){ 148 | return __('This Value is not Unique. Please enter a unique', 'acf-options-page-adder').' '.$field['label']; 149 | } 150 | return $valid; 151 | } // end public function unique_value 152 | 153 | public function set_title_field($value, $post_id, $field) { 154 | if (!empty($value)) { 155 | return $value; 156 | } 157 | // options page was created before the title field was added 158 | $title = get_the_title(intval($post_id)); 159 | if ($title != 'Auto Draft') { 160 | $value = $title; 161 | } 162 | return $value; 163 | } // end public function set_title_field 164 | 165 | public function after_setup_theme() { 166 | if (!function_exists('acf_add_options_page')) { 167 | return; 168 | } 169 | // check to see if acf5 is installed 170 | // if not then do not run anything else in this plugin 171 | // move all other actions to this function except text domain since this is too late 172 | /* 173 | if (!class_exists('acf') || 174 | !function_exists('acf_get_setting') || 175 | intval(acf_get_setting('version')) < 5 || 176 | !class_exists('acf_pro')) { 177 | $this->active = false; 178 | return; 179 | } 180 | */ 181 | add_action('admin_menu', array($this, 'build_admin_menu_list'), 9999); 182 | //add_action('admin_menu', array($this, 'add_hooks'), 9999); // makes sure everything has been added 183 | add_filter('acf/load_field/name=_acfop_parent', array($this, 'acf_load_parent_menu_field')); 184 | add_filter('acf/load_field/name=_acfop_capability', array($this, 'acf_load_capabilities_field')); 185 | add_filter('manage_edit-'.$this->post_type.'_columns', array($this, 'admin_columns')); 186 | add_action('manage_'.$this->post_type.'_posts_custom_column', array($this, 'admin_columns_content'), 10, 2); 187 | require_once(dirname(__FILE__).'/api-template.php'); 188 | } // end public function after_setup_theme 189 | 190 | public function init() { 191 | if (!function_exists('acf_add_options_page')) { 192 | return; 193 | } 194 | $this->register_post_type(); 195 | $this->acf_add_options_pages(); 196 | do_action('acf_options_page/init'); 197 | } // end public function init 198 | 199 | public function acf_include_fields() { 200 | if (!function_exists('acf_add_options_page')) { 201 | return; 202 | } 203 | // this function is called when ACF5 is installed 204 | $field_group = array( 205 | 'key' => 'acf_options-page-details', 206 | 'title' => __('Options Page Details', 'acf-options-page-adder'), 207 | 'fields' => array( 208 | array( 209 | 'key' => 'field_acf_key_acfop_tab_basic', 210 | 'label' => __('Basic Settings', 'acf-options-page-adder'), 211 | 'name' => '', 212 | 'type' => 'tab', 213 | 'instructions' => '', 214 | 'required' => 0, 215 | 'conditional_logic' => 0, 216 | 'wrapper' => array( 217 | 'width' => '', 218 | 'class' => '', 219 | 'id' => '' 220 | ), 221 | 'placement' => 'left', 222 | 'endpoint' => 0 223 | ), 224 | array( 225 | 'key' => 'field_acf_key_acfop_title', 226 | 'label' => __('Title Text', 'acf-options-page-adder'), 227 | 'name' => '_acfop_title', 228 | 'prefix' => '', 229 | 'type' => 'text', 230 | 'instructions' => __('This will be used as the options page title.', 'acf-options-page-adder'), 231 | 'required' => 1, 232 | 'conditional_logic' => 0, 233 | 'default_value' => '', 234 | 'placeholder' => '', 235 | 'prepend' => '', 236 | 'append' => '', 237 | 'maxlength' => '', 238 | 'readonly' => 0, 239 | 'disabled' => 0 240 | ), 241 | array( 242 | 'key' => 'field_acf_key_acfop_menu', 243 | 'label' => __('Menu Text', 'acf-options-page-adder'), 244 | 'name' => '_acfop_menu', 245 | 'prefix' => '', 246 | 'type' => 'text', 247 | 'instructions' => __('Will default to title if left blank.', 'acf-options-page-adder'), 248 | 'required' => 0, 249 | 'conditional_logic' => 0, 250 | 'default_value' => '', 251 | 'placeholder' => '', 252 | 'prepend' => '', 253 | 'append' => '', 254 | 'maxlength' => '', 255 | 'readonly' => 0, 256 | 'disabled' => 0 257 | ), 258 | array( 259 | 'key' => 'field_acf_key_acfop_parent', 260 | 'label' => __('Menu Location (Parent)', 'acf-options-page-adder'), 261 | 'name' => '_acfop_parent', 262 | 'prefix' => '', 263 | 'type' => 'select', 264 | 'instructions' => __('Select the menu this options page will appear under. Will default to None.', 'acf-options-page-adder'), 265 | 'required' => 0, 266 | 'conditional_logic' => 0, 267 | 'choices' => array(), // dynamic populate 268 | 'default_value' => 'none', 269 | 'allow_null' => 0, 270 | 'multiple' => 0, 271 | 'ui' => 0, 272 | 'ajax' => 0, 273 | 'placeholder' => '', 274 | 'disabled' => 0, 275 | 'readonly' => 0 276 | ), 277 | array( 278 | 'key' => 'field_acf_key_acfop_slug', 279 | 'label' => __('Slug', 'acf-options-page-adder'), 280 | 'name' => '_acfop_slug', 281 | 'prefix' => '', 282 | 'type' => 'text', 283 | 'instructions' => __('This field is optional in ACF. It is required here. You must know what the slug is to enable get_options_page_post_id() added in 4.4.0', 'acf-options-page-adder'), 284 | 'required' => 1, 285 | 'conditional_logic' => 0, 286 | 'default_value' => '', 287 | 'placeholder' => '', 288 | 'prepend' => '', 289 | 'append' => '', 290 | 'maxlength' => '', 291 | 'readonly' => 0, 292 | 'disabled' => 0 293 | ), 294 | array( 295 | 'key' => 'field_acf_key_acfop_order', 296 | 'label' => __('Order', 'acf-options-page-adder'), 297 | 'name' => '_acfop_order', 298 | 'prefix' => '', 299 | 'type' => 'number', 300 | 'instructions' => __('The order that this child menu should appear under its parent menu.', 'acf-options-page-adder'), 301 | 'required' => 0, 302 | 'conditional_logic' => array( 303 | array( 304 | array( 305 | 'field' => 'field_acf_key_acfop_parent', 306 | 'operator' => '!=', 307 | 'value' => 'none', 308 | ), 309 | ), 310 | ), 311 | 'default_value' => 0, 312 | 'placeholder' => '', 313 | 'prepend' => '', 314 | 'append' => '', 315 | 'maxlength' => '', 316 | 'readonly' => 0, 317 | 'disabled' => 0, 318 | ), 319 | array( 320 | 'key' => 'field_acf_key_acfop_show_in_graphql', 321 | 'label' => __('Show in GraphQL', 'acf-options-page-adder'), 322 | 'name' => '_acfop_show_in_graphql', 323 | 'prefix' => '', 324 | 'type' => 'true_false', 325 | 'instructions' => '', 326 | 'required' => 0, 327 | 'conditional_logic' => 0, 328 | 'wrapper' => array( 329 | 'width' => '', 330 | 'class' => '', 331 | 'id' => '', 332 | ), 333 | 'show_in_graphql' => 1, 334 | 'message' => '', 335 | 'default_value' => 0, 336 | 'ui' => 1, 337 | 'ui_on_text' => '', 338 | 'ui_off_text' => '', 339 | ), 340 | array( 341 | 'key' => 'field_acf_key_acfop_tab_advanced', 342 | 'label' => __('Advanced Settings', 'acf-options-page-adder'), 343 | 'name' => '', 344 | 'type' => 'tab', 345 | 'instructions' => '', 346 | 'required' => 0, 347 | 'conditional_logic' => 0, 348 | 'wrapper' => array( 349 | 'width' => '', 350 | 'class' => '', 351 | 'id' => '' 352 | ), 353 | 'placement' => 'left', 354 | 'endpoint' => 0 355 | ), 356 | array( 357 | 'key' => 'field_acf_key_acfop_capability', 358 | 'label' => __('Capability', 'acf-options-page-adder'), 359 | 'name' => '_acfop_capability', 360 | 'prefix' => '', 361 | 'type' => 'select', 362 | 'instructions' => __('The user capability to view this options page. Will default to manage_options.', 'acf-options-page-adder'), 363 | 'required' => 0, 364 | 'conditional_logic' => 0, 365 | 'choices' => array(), // dynamic populate 366 | 'default_value' => 'manage_options', 367 | 'allow_null' => 1, 368 | 'multiple' => 0, 369 | 'ui' => 0, 370 | 'ajax' => 0, 371 | 'placeholder' => '', 372 | 'disabled' => 0, 373 | 'readonly' => 0 374 | ), 375 | array( 376 | 'key' => 'field_acf_key_acfop_position', 377 | 'label' => __('Menu Position', 'acf-options-page-adder'), 378 | 'name' => '_acfop_position', 379 | 'prefix' => '', 380 | 'type' => 'text', 381 | 'instructions' => __('The position in the menu order this menu should appear. WARNING: if two menu items use the same position attribute, one of the items may be overwritten so that only one item displays! Risk of conflict can be reduced by using decimal instead of integer values, e.g. 63.3 instead of 63. Defaults to bottom of utility menu items.
Core Menu Item Positions: 2=Dashboard, 4=Separator, 5=Posts, 10=Media, 15=Links, 20=Pages, 25=Comments, 59=Separator, 60=Appearance, 65=Plugins, 70=Users, 75=Tools, 80=Settings, 99=Separator', 'acf-options-page-adder'), 382 | 'required' => 0, 383 | 'conditional_logic' => array( 384 | array( 385 | array( 386 | 'field' => 'field_acf_key_acfop_parent', 387 | 'operator' => '==', 388 | 'value' => 'none', 389 | ), 390 | ), 391 | ), 392 | 'default_value' => '', 393 | 'placeholder' => '', 394 | 'prepend' => '', 395 | 'append' => '', 396 | 'min' => '', 397 | 'max' => '', 398 | 'step' => '', 399 | 'readonly' => 0, 400 | 'disabled' => 0, 401 | ), 402 | array( 403 | 'key' => 'field_acf_key_acfop_icon', 404 | 'label' => __('Icon', 'acf-options-page-adder'), 405 | 'name' => '_acfop_icon', 406 | 'prefix' => '', 407 | 'type' => 'text', 408 | 'instructions' => __('The icon url for this menu. Defaults to default WordPress gear.
Check out https://developer.wordpress.org/resource/dashicons/ for what to put in this field.', 'acf-options-page-adder'), 409 | 'required' => 0, 410 | 'conditional_logic' => array( 411 | array( 412 | array( 413 | 'field' => 'field_acf_key_acfop_parent', 414 | 'operator' => '==', 415 | 'value' => 'none', 416 | ), 417 | ), 418 | ), 419 | 'default_value' => '', 420 | 'placeholder' => '', 421 | 'prepend' => '', 422 | 'append' => '', 423 | 'maxlength' => '', 424 | 'readonly' => 0, 425 | 'disabled' => 0, 426 | ), 427 | array( 428 | 'key' => 'field_acf_key_acfop_redirect', 429 | 'label' => __('Redirect', 'acf-options-page-adder'), 430 | 'name' => '_acfop_redirect', 431 | 'type' => 'true_false', 432 | 'ui' => 1, 433 | 'ui_on_text' => __('Yes', 'acf-options-page-adder'), 434 | 'ui_off_text' => __('No', 'acf-options-page-adder'), 435 | 'instructions' => __('If set to Yes, this options page will redirect to the first child page (if a child page exists). If set to No, this parent page will appear alongside any child pages. Defaults to Yes.
NOTE: Changing this setting will effect the location or appearance of sub options pages currently associated with this options page.', 'acf-options-page-adder'), 436 | 'required' => 0, 437 | 'conditional_logic' => array( 438 | array( 439 | array( 440 | 'field' => 'field_acf_key_acfop_parent', 441 | 'operator' => '==', 442 | 'value' => 'none', 443 | ), 444 | ), 445 | ), 446 | 'default_value' => 0, 447 | ), 448 | array( 449 | 'key' => 'field_acf_key_acfop_save_to', 450 | 'label' => __('Save To', 'acf-options-page-adder'), 451 | 'name' => '_acfop_save_to', 452 | 'type' => 'radio', 453 | 'instructions' => ''.__('1 The standard setting for ACF options pages.
2 Save values to a selected post.
3 You can choose to save all fields of the options page to this options page post in this plugin.
4 Use the options page slug. This replaces the standard ACF "option" prefix in the options table so that you can speicify the slug you set for this options page as the post ID.
5 Works the same as 4 except that you can specify the slug/post ID. This is useful to set other places, for example "user_1" or "term_27"', 'acf-options-page-adder').'
', 454 | 'required' => 0, 455 | 'conditional_logic' => 0, 456 | 'wrapper' => array( 457 | 'width' => '', 458 | 'class' => '', 459 | 'id' => '', 460 | ), 461 | 'choices' => array( 462 | 'options' => __('Options', 'acf-options-page-adder').'1', 463 | 'post' => __('Post Object', 'acf-options-page-adder').'2', 464 | 'this_post' => __('This Post', 'acf-options-page-adder').'3', 465 | 'page_slug' => __('Use Page Slug', 'acf-options-page-adder').'4', 466 | 'custom_slug' => __('Use Custom Slug', 'acf-options-page-adder'.'5') 467 | ), 468 | 'other_choice' => 0, 469 | 'save_other_choice' => 0, 470 | 'default_value' => 'options', 471 | 'layout' => 'horizontal', 472 | ), 473 | array( 474 | 'key' => 'field_acf_key_acfop_custom_slug', 475 | 'label' => __('Custom Slug/ID', 'acf-options-page-adder'), 476 | 'name' => '_acfop_custom_slug', 477 | 'prefix' => '', 478 | 'type' => 'text', 479 | 'instructions' => __('Enter the Custom Slug to use for saving fields on this options page.', 'acf-options-page-adder'), 480 | 'required' => 1, 481 | 'conditional_logic' => array( 482 | array( 483 | array( 484 | 'field' => 'field_acf_key_acfop_save_to', 485 | 'operator' => '==', 486 | 'value' => 'custom_slug', 487 | ), 488 | ), 489 | ), 490 | 'default_value' => '', 491 | 'placeholder' => '', 492 | 'prepend' => '', 493 | 'append' => '', 494 | 'maxlength' => '', 495 | 'readonly' => 0, 496 | 'disabled' => 0 497 | ), 498 | array( 499 | 'key' => 'field_acf_key_acfop_post_page', 500 | 'label' => __('Post/Page', 'acf-options-page-adder'), 501 | 'name' => '_acfop_post_page', 502 | 'type' => 'post_object', 503 | 'instructions' => __('Select the post object to save and load data to/from.', 'acf-options-page-adder'), 504 | 'required' => 1, 505 | 'conditional_logic' => array( 506 | array( 507 | array( 508 | 'field' => 'field_acf_key_acfop_save_to', 509 | 'operator' => '==', 510 | 'value' => 'post', 511 | ), 512 | ), 513 | ), 514 | 'wrapper' => array( 515 | 'width' => '', 516 | 'class' => '', 517 | 'id' => '', 518 | ), 519 | 'post_type' => array( 520 | ), 521 | 'taxonomy' => array( 522 | ), 523 | 'allow_null' => 0, 524 | 'multiple' => 0, 525 | 'return_format' => 'id', 526 | 'ui' => 1, 527 | ), 528 | array( 529 | 'key' => 'field_acf_key_acfop_autoload', 530 | 'label' => __('Autoload Values', 'acf-options-page-adder'), 531 | 'name' => '_acfop_autoload', 532 | 'type' => 'true_false', 533 | 'ui' => 1, 534 | 'ui_on_text' => __('Yes', 'acf-options-page-adder'), 535 | 'ui_off_text' => __('No', 'acf-options-page-adder'), 536 | 'instructions' => __('Whether to load the options (values saved from this options page) when WordPress starts up. Added in ACF v5.2.8.', 'acf-options-page-adder'), 537 | 'required' => 0, 538 | 'conditional_logic' => array( 539 | array( 540 | array( 541 | 'field' => 'field_acf_key_acfop_save_to', 542 | 'operator' => '==', 543 | 'value' => 'options', 544 | ), 545 | ), 546 | array( 547 | array( 548 | 'field' => 'field_acf_key_acfop_save_to', 549 | 'operator' => '==', 550 | 'value' => 'page_slug', 551 | ), 552 | ), 553 | array( 554 | array( 555 | 'field' => 'field_acf_key_acfop_save_to', 556 | 'operator' => '==', 557 | 'value' => 'custom_slug', 558 | ), 559 | ), 560 | ), 561 | 'default_value' => 1, 562 | ), 563 | array( 564 | 'key' => 'field_acf_key_acfop_tab_content', 565 | 'label' => __('Customize', 'acf-options-page-adder'), 566 | 'name' => '', 567 | 'type' => 'tab', 568 | 'instructions' => '', 569 | 'required' => 0, 570 | 'conditional_logic' => 0, 571 | 'wrapper' => array( 572 | 'width' => '', 573 | 'class' => '', 574 | 'id' => '' 575 | ), 576 | 'placement' => 'left', 577 | 'endpoint' => 0 578 | ), 579 | array( 580 | 'key' => 'field_acf_key_acfop_custize', 581 | 'label' => __('Customization', 'acf-options-page-adder'), 582 | 'name' => '_acfop_customize', 583 | 'type' => 'true_false', 584 | 'ui' => 1, 585 | 'ui_on_text' => __('Yes', 'acf-options-page-adder'), 586 | 'ui_off_text' => __('No', 'acf-options-page-adder'), 587 | 'instructions' => __('Turning this on will allow you to add header and footer content to the options page
WARNING: On options page with a large number of fields this feature can cause the loading of the options page to cause an out of memory fatal error. This feature should not be used on options pages that may have large numbers of fields to display. If this feature is off it will disable not only the content editors here but also will disable the filters mentioned in the documentation.', 'acf-options-page-adder'), 588 | 'message' => __('Allow Customization of Header & Footer?', 'acf-options-page-adder'), 589 | 'required' => 0, 590 | 'conditional_logic' => 0, 591 | 'default_value' => 0, 592 | ), 593 | array( 594 | 'key' => 'field_acf_key_acfop_header_content', 595 | 'label' => __('Header Content', 'acf-options-page-adder'), 596 | 'name' => '_acfop_header_content', 597 | 'type' => 'wysiwyg', 598 | 'instructions' => __('Content will be added to the options page header after the Options Page Title.', 'acf-options-page-adder'), 599 | 'required' => 0, 600 | 'conditional_logic' => array( 601 | array( 602 | array( 603 | 'field' => 'field_acf_key_acfop_custize', 604 | 'operator' => '==', 605 | 'value' => 1, 606 | ), 607 | ), 608 | ), 609 | 'wrapper' => array( 610 | 'width' => '', 611 | 'class' => '', 612 | 'id' => '', 613 | ), 614 | 'default_value' => '', 615 | 'tabs' => 'all', 616 | 'toolbar' => 'full', 617 | 'media_upload' => 1, 618 | 'delay' => 0, 619 | ), 620 | array( 621 | 'key' => 'field_acf_key_acfop_footer_content', 622 | 'label' => __('Footer Content', 'acf-options-page-adder'), 623 | 'name' => '_acfop_footer_content', 624 | 'type' => 'wysiwyg', 625 | 'instructions' => __('Content will be added to the options page footer after all ACF Field Groups.', 'acf-options-page-adder'), 626 | 'required' => 0, 627 | 'conditional_logic' => array( 628 | array( 629 | array( 630 | 'field' => 'field_acf_key_acfop_custize', 631 | 'operator' => '==', 632 | 'value' => 1, 633 | ), 634 | ), 635 | ), 636 | 'wrapper' => array( 637 | 'width' => '', 638 | 'class' => '', 639 | 'id' => '', 640 | ), 641 | 'default_value' => '', 642 | 'tabs' => 'all', 643 | 'toolbar' => 'full', 644 | 'media_upload' => 1, 645 | 'delay' => 0, 646 | ), 647 | ), 648 | 'location' => array( 649 | array( 650 | array( 651 | 'param' => 'post_type', 652 | 'operator' => '==', 653 | 'value' => $this->post_type 654 | ) 655 | ) 656 | ), 657 | 'menu_order' => 0, 658 | 'position' => 'normal', 659 | 'style' => 'default', 660 | 'label_placement' => 'left', 661 | 'instruction_placement' => 'field', 662 | 'hide_on_screen' => array( 663 | 0 => 'permalink', 664 | 1 => 'the_content', 665 | 2 => 'excerpt', 666 | 3 => 'custom_fields', 667 | 4 => 'discussion', 668 | 5 => 'comments', 669 | 6 => 'slug', 670 | 7 => 'author', 671 | 8 => 'format', 672 | 9 => 'featured_image', 673 | 10 => 'categories', 674 | 11 => 'tags' 675 | ), 676 | ); 677 | acf_add_local_field_group($field_group); 678 | } // end public function acf_include_fields 679 | 680 | private function build_options_page_settings($post_id, $title='') { 681 | $skip_hook = false; 682 | if ($title == '') { 683 | $skip_hook = true; 684 | } 685 | $settings = array(); 686 | $settings['acf'] = array(); 687 | if ($title == '') { 688 | $title = get_the_title($post_id); 689 | } 690 | $show_in_graphql = trim(get_post_meta($post_id, '_acfop_show_in_graphql', true)); 691 | if ($show_in_graphql) { 692 | $settings['acf']['show_in_graphql'] = $show_in_graphql; 693 | } 694 | $settings['acf']['page_title'] = $title; 695 | $menu_text = trim(get_post_meta($post_id, '_acfop_menu', true)); 696 | if (!$menu_text) { 697 | $menu_text = $title; 698 | } 699 | $settings['acf']['menu_title'] = $menu_text; 700 | $slug = trim(get_post_meta($post_id, '_acfop_slug', true)); 701 | if (!$slug) { 702 | $slug = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $title), '-')); 703 | } 704 | $settings['acf']['menu_slug'] = $slug; 705 | 706 | $parent = get_post_meta($post_id, '_acfop_parent', true); 707 | if ($parent == 'none') { 708 | $parent = ''; 709 | } 710 | $settings['acf']['parent_slug'] = $parent; 711 | 712 | $settings['acf']['capability'] = get_post_meta($post_id, '_acfop_capability', true); 713 | 714 | $save_id = 'options'; 715 | $save_to = get_post_meta($post_id, '_acfop_save_to', true); 716 | $autoload = 0; 717 | if ($save_to == 'post') { 718 | $save_id = intval(get_post_meta($post_id, '_acfop_post_page', true)); 719 | } elseif ($save_to == 'this_post') { 720 | $save_id = $post_id; 721 | } elseif ($save_to == 'page_slug') { 722 | $save_id = trim(get_post_meta($post_id, '_acfop_slug', true)); 723 | } elseif ($save_to == 'custom_slug') { 724 | $save_id = trim(get_post_meta($post_id, '_acfop_custom_slug', true)); 725 | } else { 726 | $autoload = intval(get_post_meta($post_id, '_acfop_autoload', true)); 727 | } 728 | $settings['acf']['post_id'] = $save_id; 729 | $settings['acf']['autoload'] = $autoload; 730 | 731 | if (!$parent) { 732 | $settings['type'] = 'page'; 733 | $settings['order'] = false; 734 | $redirect = true; 735 | $value = get_post_meta($post_id, '_acfop_redirect', true); 736 | if ($value == '0' && $value != '') { 737 | $redirect = false; 738 | } 739 | $settings['acf']['redirect'] = $redirect; 740 | 741 | $icon = ''; 742 | $value = get_post_meta($post_id, '_acfop_icon', true); 743 | if ($value != '') { 744 | $icon = $value; 745 | } 746 | $settings['acf']['icon_url'] = $icon; 747 | $menu_position = false; 748 | $value = get_post_meta($post_id, '_acfop_position', true); 749 | if ($value != '') { 750 | $menu_position = $value; 751 | } 752 | $settings['acf']['position'] = $menu_position; 753 | 754 | } else { 755 | // parent set 756 | $settings['type'] = 'sub_page'; 757 | $settings['order'] = intval(get_post_meta($post_id, '_acfop_order', true)); 758 | } 759 | if (!$skip_hook) { 760 | $settings['hook'] = get_plugin_page_hookname($slug, $parent); 761 | } 762 | $allow = get_post_meta($post_id, '_acfop_customize', true); 763 | $header = ''; 764 | $footer = ''; 765 | if ($allow === '') { 766 | $allow = 0; 767 | $header = trim(get_post_meta($post_id, '_acfop_header_content', true)); 768 | $footer = trim(get_post_meta($post_id, '_acfop_footer_content', true)); 769 | } else { 770 | $allow = intval($allow); 771 | } 772 | if ($allow || $header || $footer) { 773 | $allow = true; 774 | update_post_meta($post_id, '_acfop_customize', '1'); 775 | } else { 776 | $allow = false; 777 | update_post_meta($post_id, '_acfop_customize', '0'); 778 | } 779 | $header = trim(get_post_meta($post_id, '_acfop_header_content', true)); 780 | $footer = trim(get_post_meta($post_id, '_acfop_footer_content', true)); 781 | $settings['customize'] = $allow; 782 | $settings['header'] = $header; 783 | $settings['footer'] = $footer; 784 | 785 | return $settings; 786 | } // end private function build_options_page_settings 787 | 788 | public function add_hooks() { 789 | if (!function_exists('acf_add_options_page')) { 790 | return; 791 | } 792 | //echo '
'; print_r($this->options_pages); die;
 793 | 			foreach($this->options_pages as $id => $options_page) {
 794 | 				if (isset($options_page['customize']) && !$options_page['customize']) {
 795 | 					continue;
 796 | 				}
 797 | 				//echo get_plugin_page_hookname($options_page['acf']['menu_slug'], $options_page['acf']['parent_slug']);
 798 | 				//echo '
'; print_r($options_page); die;
 799 | 				if (isset($options_page['hook'])) {
 800 | 					$hook = $options_page['hook'];
 801 | 				} else {
 802 | 					$hook = get_plugin_page_hookname($options_page['acf']['menu_slug'], $options_page['acf']['parent_slug']);
 803 | 					$this->options_pages[$id]['hook'] = $hook;
 804 | 				}
 805 | 				add_action($hook, array($this, 'customize_start'), 1);
 806 | 				add_action($hook, array($this, 'customize_end'), 20);
 807 | 				$this->hooks[$hook] = $id;
 808 | 			}
 809 | 		} // end public function add_hooks
 810 | 		
 811 | 		public function customize_start() {
 812 | 			//echo 'here'; die;
 813 | 			ob_start();
 814 | 		} // end public function customize_start
 815 | 		
 816 | 		public function customize_end() {
 817 | 			
 818 | 			$replaces = 1;
 819 | 			
 820 | 			$content = ob_get_clean();
 821 | 			
 822 | 			
 823 | 			
 824 | 			$hook = current_filter();
 825 | 			
 826 | 			$options_page = $this->options_pages[$this->hooks[$hook]];
 827 | 			//echo $this->hooks[$hook];
 828 | 			
 829 | 			$header = '';
 830 | 			if (!$options_page['header']) {
 831 | 				$header = trim(get_post_meta($this->hooks[$hook], '_acfop_header_content', true));
 832 | 			} else {
 833 | 				$header = apply_filters('acf_the_content', $options_page['header']);
 834 | 			}
 835 | 			$header = apply_filters('acf-options-page-adder/page-header', $header, $hook);
 836 | 			if ($header) {
 837 | 				$content = str_replace('', ''.$header, $content, $replaces);
 838 | 			}
 839 | 			
 840 | 			$footer = '';
 841 | 			if (!$options_page['footer']) {
 842 | 				$footer = trim(get_post_meta($this->hooks[$hook], '_acfop_footer_content', true));
 843 | 			} else {
 844 | 				$footer = apply_filters('acf_the_content', $options_page['footer']);
 845 | 			}
 846 | 			$footer = apply_filters('acf-options-page-adder/page-footer', $footer, $hook);
 847 | 			if ($footer) {
 848 | 				$content = str_replace('', ''.$footer, $content, $replaces);
 849 | 			}
 850 | 			
 851 | 			$content = apply_filters('acf-options-page-adder/page-content', $content, $hook);
 852 | 			
 853 | 			echo $content;
 854 | 		} // end public function customize_end
 855 | 		
 856 | 		public function acf_save_post($post_id) {
 857 | 			if (!is_numeric($post_id)) {
 858 | 				return;
 859 | 			}
 860 | 			// post types that need titles set
 861 | 			$post_type = get_post_type($post_id);
 862 | 			if ($this->post_type != $post_type) {
 863 | 				return;
 864 | 			}
 865 | 			
 866 | 			remove_action('acf/save_post', array($this, 'acf_save_post'), 20);
 867 | 			
 868 | 			// set post title based on title field
 869 | 			$title = get_post_meta($post_id, '_acfop_title', true);
 870 | 			// strip all html
 871 | 			$title = preg_replace('#]*>#s', '', $title);
 872 | 			$slug = sanitize_title($title);
 873 | 			$args = array(
 874 | 				'ID' => $post_id,
 875 | 				'post_title' => $title,
 876 | 				'post_name' => $slug,
 877 | 				'post_content' => serialize($this->build_options_page_settings($post_id, $title))
 878 | 			);
 879 | 			wp_update_post($args);
 880 | 			add_action('acf/save_post', array($this, 'acf_save_post'), 20);
 881 | 			
 882 | 			// remove header/footer content if customize is turned off
 883 | 			$customize = intval(get_post_meta($post_id, '_acfop_customize', true));
 884 | 			if (!$customize) {
 885 | 				update_post_meta($post_id, '_acfop_header_content', '');
 886 | 				update_post_meta($post_id, '_acfop_footer_content', '');
 887 | 			}
 888 | 			
 889 | 		} // end public function acf_save_post
 890 | 		
 891 | 		public function acf_load_parent_menu_field($field) {
 892 | 			//$this->build_admin_menu_list();
 893 | 			$field['choices'] = $this->parent_menus;
 894 | 			return $field;
 895 | 		} // end public function acf_load_parent_menu_field
 896 | 		
 897 | 		public function acf_load_capabilities_field($field) {
 898 | 			global $wp_roles;
 899 | 			if (!$wp_roles || !count($wp_roles->roles)) {
 900 | 				return $field;
 901 | 			}
 902 | 			$sorted_caps = array();
 903 | 			$caps = array();
 904 | 			foreach ($wp_roles->roles as $role) {
 905 | 				foreach ($role['capabilities'] as $cap => $value) {
 906 | 					if (!in_array($cap, $sorted_caps)) {
 907 | 						$sorted_caps[] = $cap;
 908 | 					}
 909 | 				} // end foreach cap
 910 | 			} // end foreach role
 911 | 			sort($sorted_caps);
 912 | 			foreach ($sorted_caps as $cap) {
 913 | 				$caps[$cap] = $cap;
 914 | 			} // end foreach sorted_caps
 915 | 			$field['choices'] = $caps;
 916 | 			return $field;
 917 | 		} // end public function 
 918 | 		
 919 | 		public function admin_columns($columns) {
 920 | 			$new_columns = array();
 921 | 			foreach ($columns as $index => $column) {
 922 | 				if ($index == 'title') {
 923 | 					$new_columns[$index] = $column;
 924 | 					$new_columns['acfop_id'] = __('Post ID', 'acf-options-page-adder');
 925 | 					$new_columns['acfop_menu_text'] = __('Menu Text', 'acf-options-page-adder');
 926 | 					$new_columns['acfop_slug'] = __('Slug', 'acf-options-page-adder');
 927 | 					$new_columns['acfop_location'] = __('Location (Parent)', 'acf-options-page-adder');
 928 | 					$new_columns['acfop_redirect'] = __('Redirect', 'acf-options-page-adder');
 929 | 					$new_columns['acfop_saveto'] = __('Save To', 'acf-options-page-adder');
 930 | 					$new_columns['acfop_order'] = __('Order', 'acf-options-page-adder');
 931 | 					$new_columns['acfop_capability'] = __('Capability', 'acf-options-page-adder');
 932 | 					$new_columns['acfop_hook'] = __('Hook Suffix', 'acf-options-page-adder');
 933 | 				} else {
 934 | 					if (strtolower($column) != 'date') {
 935 | 						$new_columns[$index] = $column;
 936 | 					}
 937 | 				}
 938 | 			}
 939 | 			return $new_columns;
 940 | 		} // end public function admin_columns
 941 | 		
 942 | 		public function admin_columns_content($column_name, $post_id) {
 943 | 			switch ($column_name) {
 944 | 				case 'acfop_saveto':
 945 | 					$save_to = get_post_meta($post_id, '_acfop_save_to', true);
 946 | 					if ($save_to == 'options') {
 947 | 						$redirect = intval(get_post_meta($post_id, '_acfop_redirect', true));
 948 | 						$parent = get_post_meta($post_id, '_acfop_parent', true);
 949 | 						if ($parent == 'none' && $redirect) {
 950 | 							$save_to = '';
 951 | 						}
 952 | 					}
 953 | 					$redirect = intval(get_post_meta($post_id, '_acfop_redirect', true));
 954 | 					if ($redirect) {
 955 | 						echo __('1st sub options page value
OR
', 'acf-options-page-adder'); 956 | } 957 | if ($save_to == 'options') { 958 | echo __('Options', 'acf-options-page-adder'); 959 | } elseif ($save_to == 'post') { 960 | echo __('Post', 'acf-options-page-adder'),' ',get_post_meta($post_id, '_acfop_post_page', true); 961 | } elseif ($save_to == 'this_post') { 962 | echo __('This Post', 'acf-options-page-adder'),' (',$post_id,')'; 963 | } elseif ($save_to == 'page_slug') { 964 | $value = trim(get_post_meta($post_id, '_acfop_slug', true)); 965 | if (!$value) { 966 | $value = trim(get_the_title($post_id)); 967 | $value = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $value), '-')); 968 | } 969 | echo $value; 970 | } elseif ($save_to == 'custom_slug') { 971 | echo trim(get_post_meta($post_id, '_acfop_custom_slug', true)); 972 | } else { 973 | $slug = trim(get_post_meta($post_id, '_acfop_slug', true)); 974 | if (!$slug) { 975 | $slug = trim(get_the_title($post_id)); 976 | $slug = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $value), '-')); 977 | } 978 | $save_to = get_options_page_id($slug); 979 | //echo __('1st sub option page value
OR
', 'acf-options-page-adder'); 980 | if ($save_to == 'options') { 981 | echo __('Options', 'acf-options-page-adder'); 982 | } elseif ($save_to == $post_id) { 983 | echo __('This Post', 'acf-options-page-adder'),' (',$post_id,')'; 984 | } else { 985 | echo __('Post', 'acf-options-page-adder'),' ',$save_to; 986 | } 987 | } 988 | break; 989 | case 'acfop_id': 990 | echo $post_id; 991 | break; 992 | case 'acfop_menu_text': 993 | $value = trim(get_post_meta($post_id, '_acfop_menu', true)); 994 | if (!$value) { 995 | $value = trim(get_the_title($post_id)); 996 | } 997 | echo $value; 998 | break; 999 | case 'acfop_hook': 1000 | $slug = trim(get_post_meta($post_id, '_acfop_slug', true)); 1001 | $parent = get_post_meta($post_id, '_acfop_parent', true); 1002 | $value = get_plugin_page_hookname($slug, $parent); 1003 | echo $value; 1004 | break; 1005 | case 'acfop_slug': 1006 | $value = trim(get_post_meta($post_id, '_acfop_slug', true)); 1007 | if (!$value) { 1008 | $value = trim(get_the_title($post_id)); 1009 | $value = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $value), '-')); 1010 | } 1011 | echo $value; 1012 | break; 1013 | case 'acfop_location': 1014 | $value = get_post_meta($post_id, '_acfop_parent', true); 1015 | if (isset($this->parent_menus[$value])) { 1016 | echo $this->parent_menus[$value]; 1017 | } else { 1018 | global $acf_options_pages; 1019 | if (count($acf_options_pages)) { 1020 | foreach ($acf_options_pages as $key => $options_page) { 1021 | if ($key == $value) { 1022 | echo $options_page['menu_title']; 1023 | } // end if key == value 1024 | } // end foreach acf_options_page 1025 | } // end if cout acf_options_pages 1026 | } // end if esl 1027 | break; 1028 | case 'acfop_capability': 1029 | $value = get_post_meta($post_id, '_acfop_capability', true); 1030 | echo $value; 1031 | //the_field('_acfop_capability', $post_id); 1032 | break; 1033 | case 'acfop_order': 1034 | $value = get_post_meta($post_id, '_acfop_order', true); 1035 | if ($value != '') { 1036 | echo $value; 1037 | } 1038 | break; 1039 | case 'acfop_redirect': 1040 | $value = get_post_meta($post_id, '_acfop_redirect', true); 1041 | if ($value == 1) { 1042 | echo __('Yes', 'acf-options-page-adder'); 1043 | } elseif ($value == 0 && $value != '') { 1044 | echo __('No', 'acf-options-page-adder'); 1045 | } 1046 | break; 1047 | default: 1048 | // do nothing 1049 | break; 1050 | } // end switch 1051 | } // end public function admin_columns_content 1052 | 1053 | public function build_admin_menu_list() { 1054 | global $menu; 1055 | $parent_menus = array('none' => __('None', 'acf-options-page-adder')); 1056 | $this->exclude_locations = apply_filters('acf-options-page-adder/exlude-locations', $this->exclude_locations); 1057 | $options_pages = acf_get_options_pages(); 1058 | if (isset($GLOBALS['acf_options_pages'])) { 1059 | $options_pages = $GLOBALS['acf_options_pages']; 1060 | } 1061 | if (!count($menu)) { 1062 | // bail early 1063 | $this->parent_menus = $parent_menus; 1064 | return; 1065 | } 1066 | foreach ($menu as $index => $item) { 1067 | if (isset($item[0]) && $item[0] != '' && 1068 | isset($item[2]) && !in_array($item[2], $this->exclude_locations)) { 1069 | if ($item[2] == 'edit-comments.php') { 1070 | $parent_menus[$item[2]] = 'Comments'; 1071 | } elseif ($item[2] == 'plugins.php') { 1072 | $parent_menus[$item[2]] = 'Plugins'; 1073 | } elseif (isset($item[5]) && preg_match('/^toplevel_page_/i', $item[5]) && 1074 | is_array($options_pages) && count($options_pages)) { 1075 | // search options pages to get correct slug 1076 | $found = false; 1077 | foreach ($options_pages as $slug => $options_page) { 1078 | if ($item[0] == $options_page['page_title']) { 1079 | //$slug = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $item[0]), '-')); 1080 | $parent_menus[$slug] = $item[0]; 1081 | $found = true; 1082 | } 1083 | } 1084 | if (!$found) { 1085 | $key = $item[2]; 1086 | $value = $item[0]; 1087 | if (!preg_match('/\.php/', $key)) { 1088 | //$key = 'admin.php?page='.$key; 1089 | } 1090 | $parent_menus[$key] = $value; 1091 | } 1092 | } else { 1093 | $key = $item[2]; 1094 | $value = $item[0]; 1095 | if (!preg_match('/\.php/', $key)) { 1096 | //$key = 'admin.php?page='.$key; 1097 | } 1098 | $parent_menus[$key] = $value; 1099 | } 1100 | } // end if good parent menu 1101 | if (isset($item[6]) && substr($item[6], 0, 6) == 'fa fa-') { 1102 | $menu[$index][4] .= ' acfop-fontawesome-'.str_replace(' ', '_', $item[6]); 1103 | } 1104 | } // end foreach menu 1105 | $this->parent_menus = $parent_menus; 1106 | } // end public function build_admin_menu_listacf_load_capabilities_field 1107 | 1108 | public function load_text_domain() { 1109 | load_plugin_textdomain('acf-options-page-adder', false, dirname(plugin_basename(__FILE__)).'/lang/'); 1110 | do_action('acf_options_page/load_text_domain'); 1111 | } // end public function load_text_domain 1112 | 1113 | public function sort_by_order($a, $b) { 1114 | if ($a['order'] == $b['order']) { 1115 | return 0; 1116 | } elseif ($a['order'] < $b['order']) { 1117 | return -1; 1118 | } else { 1119 | return 1; 1120 | } 1121 | } // end public function sort_by_order 1122 | 1123 | private function register_post_type() { 1124 | // register the post type 1125 | $cap = 'manage_options'; 1126 | $cap = apply_filters('acf-options-page-adder/capability', $cap); 1127 | $capabilities = array( 1128 | 'edit_post' => $cap, 1129 | 'delete_post' => $cap, 1130 | 'edit_posts' => $cap, 1131 | 'delete_posts' => $cap, 1132 | ); 1133 | $args = array('label' => __('Options Pages', 'acf-options-page-adder'), 1134 | 'description' => '', 1135 | 'public' => false, 1136 | 'show_ui' => true, 1137 | 'show_in_menu' => true, 1138 | 'capability_type' => 'post', 1139 | 'capabilities' => $capabilities, 1140 | //'map_meta_cap' => true, 1141 | 'hierarchical' => false, 1142 | 'rewrite' => array('slug' => $this->post_type, 'with_front' => false), 1143 | 'query_var' => true, 1144 | 'exclude_from_search' => true, 1145 | 'menu_position' => 100, 1146 | 'menu_icon' => 'dashicons-admin-generic', 1147 | 'supports' => array('custom-fields','revisions'), 1148 | 'show_in_rest' => false, 1149 | 'labels' => array('name' => __('Options Pages', 'acf-options-page-adder'), 1150 | 'singular_name' => __('Options Page', 'acf-options-page-adder'), 1151 | 'menu_name' => __('Options Pages', 'acf-options-page-adder'), 1152 | 'add_new' => __('Add Options Page', 'acf-options-page-adder'), 1153 | 'add_new_item' => __('Add New Options Page', 'acf-options-page-adder'), 1154 | 'edit' => __('Edit', 'acf-options-page-adder'), 1155 | 'edit_item' => __('Edit Options Page', 'acf-options-page-adder'), 1156 | 'new_item' => __('New Options Page', 'acf-options-page-adder'), 1157 | 'view' => __('View Options Page', 'acf-options-page-adder'), 1158 | 'view_item' => __('View Options Page', 'acf-options-page-adder'), 1159 | 'search_items' => __('Search Options Pages', 'acf-options-page-adder'), 1160 | 'not_found' => __('No Options Pages Found', 'acf-options-page-adder'), 1161 | 'not_found_in_trash' => __('No Options Pages Found in Trash', 'acf-options-page-adder'), 1162 | 'parent' => __('Parent Options Page', 'acf-options-page-adder'))); 1163 | register_post_type($this->post_type, $args); 1164 | } // end private function register_post_type 1165 | 1166 | private function acf_add_options_pages() { 1167 | if (!function_exists('acf_add_options_sub_page')) { 1168 | return; 1169 | } 1170 | // get all the options pages and add them 1171 | $options_pages = array('top' => array(), 'sub' => array()); 1172 | $args = array('post_type' => $this->post_type, 1173 | 'post_status' => 'publish', 1174 | 'posts_per_page' => -1, 1175 | 'order' => 'ASC'); 1176 | 1177 | 1178 | $page_query = new WP_Query($args); 1179 | if (count($page_query->posts)) { 1180 | foreach ($page_query->posts as $post) { 1181 | $content = $post->post_content; 1182 | if ($content) { 1183 | $content = unserialize($content); 1184 | } else { 1185 | $content = $this->build_options_page_settings($post->ID); 1186 | } 1187 | $this->options_pages[$post->ID] = $content; 1188 | } // end foreach $post; 1189 | } // end if have_posts 1190 | 1191 | if (!count($this->options_pages)) { 1192 | return; 1193 | } 1194 | 1195 | $top = array(); 1196 | $sub = array(); 1197 | foreach ($this->options_pages as $page) { 1198 | if ($page['type'] == 'page') { 1199 | $top[] = $page; 1200 | } else { 1201 | $sub[] = $page; 1202 | } 1203 | } 1204 | if (count($top)) { 1205 | foreach ($top as $page) { 1206 | acf_add_options_page($page['acf']); 1207 | } 1208 | } 1209 | if (count($sub)) { 1210 | usort($sub, array($this, 'sort_by_order')); 1211 | foreach ($sub as $page) { 1212 | acf_add_options_sub_page($page['acf']); 1213 | } 1214 | } 1215 | } // end private function acf_add_options_pages 1216 | 1217 | } // end class acfOptionsPageAdder 1218 | ?> 1219 | --------------------------------------------------------------------------------