├── LICENSE ├── README.md ├── acf-multiple-taxonomy.php ├── assets ├── README.md └── images │ ├── README.md │ ├── banner-1544x500.png │ ├── banner-772x250.png │ ├── icon-128x128.png │ ├── icon-256x256.png │ └── screenshot-1.png ├── fields └── class-gr-acf-field-multiple-taxonomy-v5.php ├── lang ├── README.md ├── acf-multiple-taxonomy-ja.mo ├── acf-multiple-taxonomy-ja.po └── acf-multiple-taxonomy.pot └── readme.txt /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![banner-1544x500](https://user-images.githubusercontent.com/47914904/125542624-2fb488c8-fee9-43f2-a1bc-626cb6b0b4d6.png) 2 | 3 | # ACF: Multiple Taxonomy 4 | 5 | A simple plugin to add the Multiple Taxonomy field. It allows you to select term(s) from multiple taxonomies. 6 | 7 | ## Description 8 | 9 | - This plugin adds the Multiple Taxonomy field as one of the Advanced Custom Fields (ACF). 10 | - The **Taxonomy** field in the ACF allows you to select term(s) from **only one taxonomy**. 11 | - The **Multiple Taxonomy** field allows you to select term(s) from **multiple taxonomies**. 12 | 13 | ## Features 14 | 15 | As with ACF's Taxonomy field: 16 | - You can select a term by radio buttons or a drop-down list. 17 | - You can select terms by checkboxes or a drop-down list. 18 | - 'Save Terms' option is supported. 19 | - 'Load Terms' option is supported. 20 | - 'Return Value' option is supported (Term Object or Term ID). 21 | 22 | Note: 23 | - 'Create Terms' option is not supported. 24 | 25 | ## Link 26 | 27 | [Plugin page (Wordpress.org)](https://wordpress.org/plugins/acf-multiple-taxonomy/) 28 | 29 | ## Changelog 30 | ### 1.0.9 31 | - Fixed AJAX issues that occurred when selecting terms. See [Github](https://github.com/game-ryo/acf-multiple-taxonomy/issues/3). 32 | ### 1.0.8 33 | - Fixed AJAX verification error in ACF6.3.10. Thanks again to [justinmaurerdotdev](https://github.com/justinmaurerdotdev) for [his contribution](https://github.com/game-ryo/acf-multiple-taxonomy/pull/6). 34 | ### 1.0.7 35 | - Fixes the AJAX handling compatibility issue introduced in ACF 6.3.2. Thanks to [justinmaurerdotdev](https://github.com/justinmaurerdotdev) for [his contribution](https://github.com/game-ryo/acf-multiple-taxonomy/pull/5). 36 | ### 1.0.6 37 | - Removed the Stylized UI toggle button on the field settings screen. This option is now always on. 38 | ### 1.0.5 39 | - Fixed serious errors that had occurred with the last update. I sincerely apologize to the users. 40 | ### 1.0.4 41 | - Fixed performance issues with the grid view in the Media Library 42 | ### 1.0.3 43 | - Fix warnings when invalid taxonomy is loaded 44 | ### 1.0.2 45 | - Fix warnings when using radio/checkbox in php 8.0 46 | - Delete unnecessary css and js files 47 | ### 1.0.1 48 | - Remove undefined variable which caused warning in php 8.0 49 | ### 1.0.0 50 | - Initial Release. 51 | -------------------------------------------------------------------------------- /acf-multiple-taxonomy.php: -------------------------------------------------------------------------------- 1 | settings = array( 47 | 'version' => '1.0.9', 48 | 'url' => plugin_dir_url( __FILE__ ), 49 | 'path' => plugin_dir_path( __FILE__ ) 50 | ); 51 | 52 | 53 | // include field 54 | add_action('acf/include_field_types', array($this, 'include_field')); // v5 55 | add_action('acf/register_fields', array($this, 'include_field')); // v4 56 | } 57 | 58 | 59 | /* 60 | * include_field 61 | * 62 | * This function will include the field type class 63 | * 64 | * @type function 65 | * @date 17/02/2016 66 | * @since 1.0.0 67 | * 68 | * @param $version (int) major ACF version. Defaults to false 69 | * @return void 70 | */ 71 | 72 | function include_field( $version = false ) { 73 | 74 | // support empty $version 75 | if( !$version ) $version = 4; 76 | 77 | 78 | // load textdomain 79 | load_plugin_textdomain( 'acf-multiple-taxonomy', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' ); 80 | 81 | 82 | // include 83 | include_once('fields/class-gr-acf-field-multiple-taxonomy-v' . $version . '.php'); 84 | } 85 | 86 | } 87 | 88 | 89 | // initialize 90 | new gr_acf_plugin_multiple_taxonomy(); 91 | 92 | 93 | // class_exists check 94 | endif; 95 | 96 | ?> 97 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # assets directory 2 | 3 | Use this directory to store asset files such as CSS, JS and images. 4 | 5 | This directory can be removed if not used. 6 | -------------------------------------------------------------------------------- /assets/images/README.md: -------------------------------------------------------------------------------- 1 | # Images directory 2 | 3 | Use this directory to store images. 4 | 5 | This directory can be removed if not used. 6 | -------------------------------------------------------------------------------- /assets/images/banner-1544x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-ryo/acf-multiple-taxonomy/25b212dc491463d56d417fdfaff91c6a85d349c7/assets/images/banner-1544x500.png -------------------------------------------------------------------------------- /assets/images/banner-772x250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-ryo/acf-multiple-taxonomy/25b212dc491463d56d417fdfaff91c6a85d349c7/assets/images/banner-772x250.png -------------------------------------------------------------------------------- /assets/images/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-ryo/acf-multiple-taxonomy/25b212dc491463d56d417fdfaff91c6a85d349c7/assets/images/icon-128x128.png -------------------------------------------------------------------------------- /assets/images/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-ryo/acf-multiple-taxonomy/25b212dc491463d56d417fdfaff91c6a85d349c7/assets/images/icon-256x256.png -------------------------------------------------------------------------------- /assets/images/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-ryo/acf-multiple-taxonomy/25b212dc491463d56d417fdfaff91c6a85d349c7/assets/images/screenshot-1.png -------------------------------------------------------------------------------- /fields/class-gr-acf-field-multiple-taxonomy-v5.php: -------------------------------------------------------------------------------- 1 | name = 'multiple_taxonomy'; 35 | $this->label = __('Multiple Taxonomy', 'acf-multiple-taxonomy'); 36 | $this->category = 'relational'; 37 | $this->defaults = array( 38 | 'taxonomy' => [], 39 | 'field_type' => 'multi_select', 40 | 'multiple' => 0, 41 | 'allow_null' => 0, 42 | 'return_format' => 'id', 43 | 'load_terms' => 0, 44 | 'save_terms' => 0, 45 | ); 46 | $this->l10n = array( 47 | 'error' => __('Error!', 'acf-multiple-taxonomy'), 48 | ); 49 | $this->settings = $settings; 50 | 51 | // register filter variations 52 | acf_add_filter_variations( 'acf/fields/multiple_taxonomy/query', array('name', 'key'), 1 ); 53 | acf_add_filter_variations( 'acf/fields/multiple_taxonomy/result', array('name', 'key'), 2 ); 54 | 55 | // ajax 56 | add_action('wp_ajax_acf/fields/multiple_taxonomy/query', array($this, 'ajax_query')); 57 | add_action('wp_ajax_nopriv_acf/fields/multiple_taxonomy/query', array($this, 'ajax_query')); 58 | 59 | // actions 60 | add_action('acf/save_post', array($this, 'save_post'), 15, 1); 61 | 62 | // do not delete! 63 | parent::__construct(); 64 | 65 | } 66 | 67 | 68 | /* 69 | * ajax_query 70 | * 71 | * description 72 | * 73 | * @type function 74 | * @date 24/10/13 75 | * @since 5.0.0 76 | * 77 | * @param $post_id (int) 78 | * @return $post_id (int) 79 | */ 80 | 81 | function ajax_query() { 82 | 83 | $nonce = acf_request_arg( 'nonce', '' ); 84 | $key = acf_request_arg( 'field_key', '' ); 85 | 86 | // Back-compat for field settings. 87 | if ( ! acf_is_field_key( $key ) ) { 88 | $nonce = ''; 89 | $key = ''; 90 | } 91 | 92 | // validate 93 | /** 94 | * In `acf_verify_ajax()`, the action is expected to be in this format: 'acf_field_' . $this->name . '_' . $key; 95 | * Because this field is ultimately rendered by the select field class, the nonce action used to create the 96 | * nonce is tied to 'select' instead of 'multiple_taxonomy'. So, here we set the action and then run our own 97 | * validation of the nonce. 98 | */ 99 | $action = 'acf_field_select_' . $key; 100 | if ( ! wp_verify_nonce( sanitize_text_field( $nonce), $action ) ) { 101 | wp_send_json_error(); 102 | die(); 103 | } 104 | 105 | // get choices 106 | $response = $this->get_ajax_query( $_POST ); 107 | 108 | // return 109 | acf_send_ajax_results($response); 110 | 111 | } 112 | 113 | 114 | /* 115 | * get_ajax_query 116 | * 117 | * This function will return an array of data formatted for use in a select2 AJAX response 118 | * 119 | * @type function 120 | * @date 15/10/2014 121 | * @since 5.0.9 122 | * 123 | * @param $options (array) 124 | * @return (array) 125 | */ 126 | 127 | function get_ajax_query( $options = array() ) { 128 | 129 | // defaults 130 | $options = acf_parse_args( $options, array( 131 | 'post_id' => 0, 132 | 's' => '', 133 | 'field_key' => '', 134 | 'paged' => 0, 135 | )); 136 | 137 | 138 | // load field 139 | $field = acf_get_field( $options['field_key'] ); 140 | if( !$field ) return false; 141 | 142 | 143 | // get all taxonomy if no taxonomy 144 | if( ! $field['taxonomy'] ) { 145 | 146 | $field['taxonomy'] = acf_get_taxonomies(); 147 | 148 | } 149 | 150 | 151 | // vars 152 | $results = array(); 153 | $limit = 20; 154 | $global_offset = 20 * ( $options['paged'] - 1 ); 155 | $total_terms = 0; 156 | $terms_collected = 0; 157 | $all_terms = array(); 158 | 159 | // First pass: Count total terms and collect all terms 160 | foreach( $field['taxonomy'] as $taxonomy ) { 161 | $is_hierarchical = is_taxonomy_hierarchical( $taxonomy ); 162 | $is_search = false; 163 | 164 | // args 165 | $args = array( 166 | 'taxonomy' => $taxonomy, 167 | 'hide_empty' => false, 168 | ); 169 | 170 | // search 171 | if( $options['s'] !== '' ) { 172 | // strip slashes (search may be integer) 173 | $s = wp_unslash( strval( $options['s'] ) ); 174 | 175 | // update vars 176 | $args['search'] = $s; 177 | $is_search = true; 178 | } 179 | 180 | // filters 181 | $args = apply_filters('acf/fields/multiple_taxonomy/query', $args, $field, $options['post_id'] ); 182 | 183 | // get terms 184 | $terms = acf_get_terms( $args ); 185 | 186 | // sort into hierarchical order! 187 | if( $is_hierarchical && !$is_search ) { 188 | // get parent 189 | $parent = acf_maybe_get( $args, 'parent', 0 ); 190 | $parent = acf_maybe_get( $args, 'child_of', $parent ); 191 | 192 | // order terms 193 | $ordered_terms = _get_term_children( $parent, $terms, $taxonomy ); 194 | 195 | // check for empty array (possible if parent did not exist within original data) 196 | if( !empty( $ordered_terms ) ) { 197 | $terms = $ordered_terms; 198 | } 199 | } 200 | 201 | // Add taxonomy label to each term for sorting 202 | foreach( $terms as $term ) { 203 | $term->taxonomy_label = get_taxonomy( $taxonomy )->label; 204 | } 205 | 206 | $all_terms = array_merge($all_terms, $terms); 207 | $total_terms += count($terms); 208 | } 209 | 210 | // Apply global pagination 211 | $paginated_terms = array_slice($all_terms, $global_offset, $limit); 212 | 213 | // Group by taxonomy 214 | $grouped_terms = array(); 215 | foreach( $paginated_terms as $term ) { 216 | $taxonomy = $term->taxonomy; 217 | $taxonomy_label = $term->taxonomy_label; 218 | 219 | if( !isset($grouped_terms[$taxonomy]) ) { 220 | $grouped_terms[$taxonomy] = array( 221 | 'label' => $taxonomy_label, 222 | 'terms' => array() 223 | ); 224 | } 225 | 226 | $grouped_terms[$taxonomy]['terms'][] = $term; 227 | } 228 | 229 | // Format results for select2 230 | foreach( $grouped_terms as $taxonomy => $data ) { 231 | $result = array( 232 | 'text' => $data['label'], 233 | 'children' => array() 234 | ); 235 | 236 | foreach( $data['terms'] as $term ) { 237 | $result['children'][] = array( 238 | 'id' => $term->term_id, 239 | 'text' => $this->get_term_title( $term, $field, $options['post_id'] ) 240 | ); 241 | } 242 | 243 | $results[] = $result; 244 | } 245 | 246 | // vars 247 | $response = array( 248 | 'results' => $results, 249 | 'limit' => $limit, 250 | ); 251 | 252 | // return 253 | return $response; 254 | } 255 | 256 | 257 | /* 258 | * render_field_settings() 259 | * 260 | * Create extra settings for your field. These are visible when editing a field 261 | * 262 | * @type action 263 | * @since 3.6 264 | * @date 23/01/13 265 | * 266 | * @param $field (array) the $field being edited 267 | * @return n/a 268 | */ 269 | 270 | function render_field_settings( $field ) { 271 | 272 | 273 | // taxonomy 274 | acf_render_field_setting( $field, array( 275 | 'label' => __('Taxonomy','acf'), 276 | 'instructions' => __('Select the taxonomy to be displayed','acf'), 277 | 'type' => 'select', 278 | 'name' => 'taxonomy', 279 | 'choices' => acf_get_taxonomy_labels(), 280 | 'multiple' => 1, 281 | 'ui' => 1, 282 | 'allow_null' => 1, 283 | 'placeholder' => __("All taxonomy",'acf'), 284 | )); 285 | 286 | 287 | // field_type 288 | acf_render_field_setting( $field, array( 289 | 'label' => __('Appearance','acf'), 290 | 'instructions' => __('Select the appearance of this field','acf'), 291 | 'type' => 'select', 292 | 'name' => 'field_type', 293 | 'optgroup' => true, 294 | 'choices' => array( 295 | __("Multiple Values",'acf') => array( 296 | 'checkbox' => __('Checkbox', 'acf'), 297 | 'multi_select' => __('Multi Select', 'acf') 298 | ), 299 | __("Single Value",'acf') => array( 300 | 'radio' => __('Radio Buttons', 'acf'), 301 | 'select' => _x('Select', 'noun', 'acf') 302 | ) 303 | ) 304 | )); 305 | 306 | 307 | // allow_null 308 | acf_render_field_setting( $field, array( 309 | 'label' => __('Allow Null?','acf'), 310 | 'instructions' => '', 311 | 'name' => 'allow_null', 312 | 'type' => 'true_false', 313 | 'ui' => 1, 314 | )); 315 | 316 | 317 | // save_terms 318 | acf_render_field_setting( $field, array( 319 | 'label' => __('Save Terms','acf'), 320 | 'instructions' => __('Connect selected terms to the post','acf'), 321 | 'name' => 'save_terms', 322 | 'type' => 'true_false', 323 | 'ui' => 1, 324 | )); 325 | 326 | 327 | // load_terms 328 | acf_render_field_setting( $field, array( 329 | 'label' => __('Load Terms','acf'), 330 | 'instructions' => __('Load value from posts terms','acf'), 331 | 'name' => 'load_terms', 332 | 'type' => 'true_false', 333 | 'ui' => 1, 334 | )); 335 | 336 | 337 | // return_format 338 | acf_render_field_setting( $field, array( 339 | 'label' => __('Return Value','acf'), 340 | 'instructions' => '', 341 | 'type' => 'radio', 342 | 'name' => 'return_format', 343 | 'choices' => array( 344 | 'object' => __("Term Object",'acf'), 345 | 'id' => __("Term ID",'acf') 346 | ), 347 | 'layout' => 'horizontal', 348 | )); 349 | 350 | } 351 | 352 | 353 | 354 | /* 355 | * prepare_field 356 | * 357 | * This function will prepare the field for input 358 | * 359 | * @type function 360 | * @date 14/2/17 361 | * @since 5.5.8 362 | * 363 | * @param $field (array) 364 | * @return (int) 365 | */ 366 | 367 | function prepare_field( $field ) { 368 | 369 | // get all taxonomy when no taxonomy 370 | if( ! $field['taxonomy'] ) { 371 | 372 | $field['taxonomy'] = $this->saved_all_taxonomies === [] ? acf_get_taxonomies() : $this->saved_all_taxonomies; 373 | 374 | } 375 | 376 | // prepare choices 377 | $choices = $this->prepare_choices( $field ); 378 | 379 | // Set type 380 | if( $field['field_type'] === 'select' ) { 381 | 382 | $field['type'] = 'select'; 383 | $field['multiple'] = 0; 384 | 385 | } elseif( $field['field_type'] === 'multi_select' ) { 386 | 387 | $field['type'] = 'select'; 388 | $field['multiple'] = 1; 389 | 390 | } elseif( $field['field_type'] === 'radio' ) { 391 | 392 | $field['type'] = 'radio'; 393 | $field['layout'] = 'vertical'; 394 | $field['other_choice'] = 0; 395 | 396 | } elseif( $field['field_type'] === 'checkbox' ) { 397 | 398 | $field['type'] = 'checkbox'; 399 | $field['layout'] = 'vertical'; 400 | $field['toggle'] = 0; 401 | $field['allow_custom'] = 0; 402 | 403 | } 404 | 405 | // Add choices and ajax 406 | $field['choices'] = $choices; 407 | $field['ajax'] = 1; 408 | $field['ajax_action'] = 'acf/fields/multiple_taxonomy/query'; 409 | 410 | // Always enable "Stylized UI" option 411 | $field['ui'] = 1; 412 | 413 | // Let ACF handle the rest 414 | return $field; 415 | } 416 | 417 | 418 | /** 419 | * Returns choices 420 | * 421 | * @param array $field 422 | * @return array 423 | */ 424 | function prepare_choices( $field ) { 425 | 426 | $taxonomies = (array)$field['taxonomy']; 427 | if( $taxonomies === [] ) return []; 428 | 429 | $taxonomy_key = implode( '--', $taxonomies ); 430 | if( isset( $this->saved_taxonomy_set_choices[ $taxonomy_key ] ) ) return $this->saved_taxonomy_set_choices[ $taxonomy_key ]; 431 | 432 | // prepare choices 433 | $choices = array(); 434 | 435 | foreach( $taxonomies as $taxonomy ) { 436 | 437 | if( isset( $this->saved_taxonomy_choices[ $taxonomy ] ) ) { 438 | $choices = $choices + $this->saved_taxonomy_choices[ $taxonomy ]; 439 | continue; 440 | } 441 | 442 | // args 443 | $args = array( 444 | 'taxonomy' => $taxonomy, 445 | 'hide_empty' => false 446 | ); 447 | 448 | // get terms 449 | $terms = acf_get_terms( $args ); 450 | 451 | 452 | // make choices 453 | $taxonomy_choices = array(); 454 | foreach( $terms as $term ) { 455 | 456 | if ( is_array( $term ) ) continue; 457 | $taxonomy_choices[ $term->term_id ] = $this->get_term_title( $term, $field ); 458 | 459 | } 460 | 461 | // set choices 462 | $choices = $choices + $taxonomy_choices; 463 | $this->saved_taxonomy_choices[ $taxonomy ] = $taxonomy_choices; 464 | 465 | } 466 | 467 | $this->saved_taxonomy_set_choices[ $taxonomy_key ] = $choices; 468 | return $choices; 469 | } 470 | 471 | 472 | /** 473 | * Returns the Term's title displayed in the field UI. 474 | * 475 | * @date 1/11/2013 476 | * @since 5.0.0 477 | * 478 | * @param WP_Term $term The term object. 479 | * @param array $field The field settings. 480 | * @param mixed $post_id The post_id being edited. 481 | * @return string 482 | */ 483 | function get_term_title( $term, $field, $post_id = 0 ) { 484 | $title = acf_get_term_title( $term ); 485 | 486 | // Default $post_id to current post being edited. 487 | $post_id = $post_id ? $post_id : acf_get_form_data('post_id'); 488 | 489 | /** 490 | * Filters the term title. 491 | * 492 | * @date 1/11/2013 493 | * @since 5.0.0 494 | * 495 | * @param string $title The term title. 496 | * @param WP_Term $term The term object. 497 | * @param array $field The field settings. 498 | * @param (int|string) $post_id The post_id being edited. 499 | */ 500 | return apply_filters('acf/fields/multiple_taxonomy/result', $title, $term, $field, $post_id); 501 | } 502 | 503 | 504 | /* 505 | * get_terms 506 | * 507 | * This function will return an array of terms for a given field value 508 | * 509 | * @type function 510 | * @date 13/06/2014 511 | * @since 5.0.0 512 | * 513 | * @param $value (array) 514 | * @return $value 515 | */ 516 | 517 | function get_terms( $value, $taxonomy = 'category' ) { 518 | 519 | // load terms in 1 query to save multiple DB calls from following code 520 | if( count($value) > 1 ) { 521 | 522 | $terms = acf_get_terms(array( 523 | 'taxonomy' => $taxonomy, 524 | 'include' => $value, 525 | 'hide_empty' => false 526 | )); 527 | 528 | } 529 | 530 | 531 | // update value to include $post 532 | foreach( array_keys($value) as $i ) { 533 | 534 | $value[ $i ] = get_term( $value[ $i ] ); 535 | 536 | } 537 | 538 | 539 | // filter out null values 540 | $value = array_filter($value); 541 | 542 | 543 | // return 544 | return $value; 545 | } 546 | 547 | 548 | /* 549 | * load_value() 550 | * 551 | * This filter is applied to the $value after it is loaded from the db 552 | * 553 | * @type filter 554 | * @since 3.6 555 | * @date 23/01/13 556 | * 557 | * @param $value (mixed) the value found in the database 558 | * @param $post_id (mixed) the $post_id from which the value was loaded 559 | * @param $field (array) the field array holding all the field options 560 | * @return $value 561 | */ 562 | 563 | function load_value( $value, $post_id, $field ) { 564 | 565 | // get valid terms 566 | foreach( (array)$field['taxonomy'] as $taxonomy ) { 567 | 568 | $value = acf_get_valid_terms( $value, $taxonomy ); 569 | 570 | } 571 | 572 | 573 | // load_terms 574 | if( $field['load_terms'] ) { 575 | 576 | // Decode $post_id for $type and $id. 577 | extract( acf_decode_post_id($post_id) ); 578 | if( $type === 'block' ) { 579 | // Get parent block... 580 | } 581 | 582 | // get terms 583 | $term_ids = wp_get_object_terms( $id, $field['taxonomy'], array('fields' => 'ids', 'orderby' => 'none') ); 584 | 585 | 586 | // bail early if no terms 587 | if( empty($term_ids) || is_wp_error($term_ids) ) return false; 588 | 589 | 590 | // sort 591 | if( !empty($value) ) { 592 | 593 | $order = array(); 594 | 595 | foreach( $term_ids as $i => $v ) { 596 | 597 | $order[ $i ] = array_search($v, $value); 598 | 599 | } 600 | 601 | array_multisort($order, $term_ids); 602 | 603 | } 604 | 605 | 606 | // update value 607 | $value = $term_ids; 608 | 609 | } 610 | 611 | 612 | // convert back from array if necessary 613 | if( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) { 614 | 615 | $value = array_shift($value); 616 | 617 | } 618 | 619 | 620 | // return 621 | return $value; 622 | 623 | } 624 | 625 | 626 | /* 627 | * update_value() 628 | * 629 | * This filter is applied to the $value before it is saved in the db 630 | * 631 | * @type filter 632 | * @since 3.6 633 | * @date 23/01/13 634 | * 635 | * @param $value (mixed) the value found in the database 636 | * @param $post_id (mixed) the $post_id from which the value was loaded 637 | * @param $field (array) the field array holding all the field options 638 | * @return $value 639 | */ 640 | 641 | function update_value( $value, $post_id, $field ) { 642 | 643 | // vars 644 | if( is_array($value) ) { 645 | 646 | $value = array_filter($value); 647 | 648 | } 649 | 650 | 651 | // save_terms 652 | if( $field['save_terms'] ) { 653 | 654 | foreach( (array)$field['taxonomy'] as $taxonomy ) { 655 | 656 | // force value to array 657 | $term_ids = acf_get_array( $value ); 658 | 659 | 660 | // convert to int 661 | $term_ids = array_map('intval', $term_ids); 662 | 663 | 664 | // extract term ids to append 665 | $ids_to_append = array(); 666 | 667 | foreach( $term_ids as $term_id ) { 668 | 669 | if( get_term( $term_id )->taxonomy === $taxonomy ) { 670 | 671 | $ids_to_append[] = $term_id; 672 | 673 | } 674 | 675 | } 676 | 677 | 678 | // get existing term id's (from a previously saved field) 679 | $old_term_ids = isset($this->save_post_terms[ $taxonomy ]) ? $this->save_post_terms[ $taxonomy ] : array(); 680 | 681 | 682 | // append 683 | $this->save_post_terms[ $taxonomy ] = array_merge($old_term_ids, $ids_to_append); 684 | 685 | } 686 | 687 | 688 | // if called directly from frontend update_field() 689 | if( !did_action('acf/save_post') ) { 690 | 691 | $this->save_post( $post_id ); 692 | 693 | return $value; 694 | 695 | } 696 | 697 | } 698 | 699 | 700 | // return 701 | return $value; 702 | 703 | } 704 | 705 | 706 | 707 | /* 708 | * save_post 709 | * 710 | * This function will save any terms in the save_post_terms array 711 | * 712 | * @type function 713 | * @date 26/11/2014 714 | * @since 5.0.9 715 | * 716 | * @param $post_id (int) 717 | * @return n/a 718 | */ 719 | 720 | function save_post( $post_id ) { 721 | 722 | // Check for saved terms. 723 | if( !empty($this->save_post_terms) ) { 724 | 725 | // Determine object ID allowing for non "post" $post_id (user, taxonomy, etc). 726 | // Although not fully supported by WordPress, non "post" objects may use the term relationships table. 727 | // Sharing taxonomies across object types is discoraged, but unique taxonomies work well. 728 | // Note: Do not attempt to restrict to "post" only. This has been attempted in 5.8.9 and later reverted. 729 | extract( acf_decode_post_id($post_id) ); 730 | if( $type === 'block' ) { 731 | // Get parent block... 732 | } 733 | 734 | // Loop over taxonomies and save terms. 735 | foreach( $this->save_post_terms as $taxonomy => $term_ids ){ 736 | wp_set_object_terms( $post_id, $term_ids, $taxonomy, false ); 737 | } 738 | 739 | // Reset storage. 740 | $this->save_post_terms = array(); 741 | } 742 | } 743 | 744 | 745 | 746 | /* 747 | * format_value() 748 | * 749 | * This filter is applied to the $value after it is loaded from the db and before it is returned to the template 750 | * 751 | * @type filter 752 | * @since 3.6 753 | * @date 23/01/13 754 | * 755 | * @param $value (mixed) the value which was loaded from the database 756 | * @param $post_id (mixed) the $post_id from which the value was loaded 757 | * @param $field (array) the field array holding all the field options 758 | * 759 | * @return $value (mixed) the modified value 760 | */ 761 | 762 | function format_value( $value, $post_id, $field ) { 763 | 764 | // bail early if no value 765 | if( empty($value) ) return false; 766 | 767 | 768 | // force value to array 769 | $value = acf_get_array( $value ); 770 | 771 | 772 | // load terms if needed 773 | if( $field['return_format'] == 'object' ) { 774 | 775 | // get terms 776 | $value = $this->get_terms( $value, $field["taxonomy"] ); 777 | 778 | } 779 | 780 | 781 | // convert back from array if necessary 782 | if( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) { 783 | 784 | $value = array_shift($value); 785 | 786 | } 787 | 788 | 789 | // return 790 | return $value; 791 | 792 | } 793 | 794 | 795 | } 796 | 797 | 798 | // initialize 799 | new gr_acf_field_multiple_taxonomy( $this->settings ); 800 | 801 | 802 | // class_exists check 803 | endif; 804 | 805 | ?> 806 | -------------------------------------------------------------------------------- /lang/README.md: -------------------------------------------------------------------------------- 1 | # Translations directory 2 | 3 | Use this directory to store .po and .mo files. 4 | 5 | This directory can be removed if not used. 6 | -------------------------------------------------------------------------------- /lang/acf-multiple-taxonomy-ja.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-ryo/acf-multiple-taxonomy/25b212dc491463d56d417fdfaff91c6a85d349c7/lang/acf-multiple-taxonomy-ja.mo -------------------------------------------------------------------------------- /lang/acf-multiple-taxonomy-ja.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "POT-Creation-Date: 2021-01-19 10:51+0900\n" 5 | "PO-Revision-Date: 2021-01-19 10:59+0900\n" 6 | "Last-Translator: game-ryo \n" 7 | "Language-Team: \n" 8 | "Language: ja\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 2.4.2\n" 13 | "X-Poedit-Basepath: ..\n" 14 | "Plural-Forms: nplurals=1; plural=0;\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | "X-Poedit-KeywordsList: __;_e\n" 17 | "X-Poedit-SearchPath-0: .\n" 18 | 19 | #: acf-multiple-taxonomy.php:4 20 | msgid "ACF: Multiple Taxonomy" 21 | msgstr "ACF: Multiple Taxonomy" 22 | 23 | #: acf-multiple-taxonomy.php:6 24 | msgid "A simple plugin to add a Multiple Taxonomy field. It allows you to select term(s) from multiple taxonomy." 25 | msgstr "複数のタクソノミーからタームを選択可能な「複数タクソノミー」フィールドを追加するシンプルなプラグイン。" 26 | 27 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:32 28 | msgid "Multiple Taxonomy" 29 | msgstr "複数タクソノミー" 30 | 31 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:44 32 | msgid "Error!" 33 | msgstr "エラー!" 34 | 35 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:280 36 | msgid "Taxonomy" 37 | msgstr "タクソノミー" 38 | 39 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:281 40 | msgid "Select the taxonomy to be displayed" 41 | msgstr "表示されるタクソノミーを選択" 42 | 43 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:288 44 | msgid "All taxonomy" 45 | msgstr "全てのタクソノミー" 46 | 47 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:294 48 | msgid "Appearance" 49 | msgstr "外観" 50 | 51 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:295 52 | msgid "Select the appearance of this field" 53 | msgstr "このフィールドの外観を選択" 54 | 55 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:300 56 | msgid "Multiple Values" 57 | msgstr "複数値" 58 | 59 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:301 60 | msgid "Checkbox" 61 | msgstr "チェックボックス" 62 | 63 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:302 64 | msgid "Multi Select" 65 | msgstr "複数選択" 66 | 67 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:304 68 | msgid "Single Value" 69 | msgstr "単一値" 70 | 71 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:305 72 | msgid "Radio Buttons" 73 | msgstr "ラジオボタン" 74 | 75 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:306 76 | msgctxt "noun" 77 | msgid "Select" 78 | msgstr "選択肢" 79 | 80 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:314 81 | msgid "Allow Null?" 82 | msgstr "空の値を許容するか?" 83 | 84 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:324 85 | msgid "Stylised UI" 86 | msgstr "スタイリッシュなUI" 87 | 88 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:334 89 | msgid "Save Terms" 90 | msgstr "タームの保存" 91 | 92 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:335 93 | msgid "Connect selected terms to the post" 94 | msgstr "選択されたタームを投稿に関連付ける" 95 | 96 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:344 97 | msgid "Load Terms" 98 | msgstr "タームの読み込み" 99 | 100 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:345 101 | msgid "Load value from posts terms" 102 | msgstr "投稿に関連付けられたタームを読み込む" 103 | 104 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:354 105 | msgid "Return Value" 106 | msgstr "返り値" 107 | 108 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:359 109 | msgid "Term Object" 110 | msgstr "タームオブジェクト" 111 | 112 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:360 113 | msgid "Term ID" 114 | msgstr "ターム ID" 115 | -------------------------------------------------------------------------------- /lang/acf-multiple-taxonomy.pot: -------------------------------------------------------------------------------- 1 | #, fuzzy 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: \n" 5 | "POT-Creation-Date: 2021-01-19 10:51+0900\n" 6 | "PO-Revision-Date: 2021-01-19 10:51+0900\n" 7 | "Last-Translator: \n" 8 | "Language-Team: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 2.4.2\n" 13 | "X-Poedit-Basepath: ..\n" 14 | "Plural-Forms: nplurals=1; plural=0;\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | "X-Poedit-KeywordsList: __;_e\n" 17 | "X-Poedit-SearchPath-0: .\n" 18 | 19 | #: acf-multiple-taxonomy.php:4 20 | msgid "ACF: Multiple Taxonomy" 21 | msgstr "" 22 | 23 | #: acf-multiple-taxonomy.php:6 24 | msgid "A simple plugin to add a Multiple Taxonomy field. It allows you to select term(s) from multiple taxonomy." 25 | msgstr "" 26 | 27 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:32 28 | msgid "Multiple Taxonomy" 29 | msgstr "" 30 | 31 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:44 32 | msgid "Error!" 33 | msgstr "" 34 | 35 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:280 36 | msgid "Taxonomy" 37 | msgstr "" 38 | 39 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:281 40 | msgid "Select the taxonomy to be displayed" 41 | msgstr "" 42 | 43 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:288 44 | msgid "All taxonomy" 45 | msgstr "" 46 | 47 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:294 48 | msgid "Appearance" 49 | msgstr "" 50 | 51 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:295 52 | msgid "Select the appearance of this field" 53 | msgstr "" 54 | 55 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:300 56 | msgid "Multiple Values" 57 | msgstr "" 58 | 59 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:301 60 | msgid "Checkbox" 61 | msgstr "" 62 | 63 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:302 64 | msgid "Multi Select" 65 | msgstr "" 66 | 67 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:304 68 | msgid "Single Value" 69 | msgstr "" 70 | 71 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:305 72 | msgid "Radio Buttons" 73 | msgstr "" 74 | 75 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:314 76 | msgid "Allow Null?" 77 | msgstr "" 78 | 79 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:324 80 | msgid "Stylised UI" 81 | msgstr "" 82 | 83 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:334 84 | msgid "Save Terms" 85 | msgstr "" 86 | 87 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:335 88 | msgid "Connect selected terms to the post" 89 | msgstr "" 90 | 91 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:344 92 | msgid "Load Terms" 93 | msgstr "" 94 | 95 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:345 96 | msgid "Load value from posts terms" 97 | msgstr "" 98 | 99 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:354 100 | msgid "Return Value" 101 | msgstr "" 102 | 103 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:359 104 | msgid "Term Object" 105 | msgstr "" 106 | 107 | #: fields/class-gr-acf-field-multiple-taxonomy-v5.php:360 108 | msgid "Term ID" 109 | msgstr "" 110 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === ACF: Multiple Taxonomy === 2 | Contributors: game-ryo 3 | Tags: acf, multiple, taxonomy 4 | Requires at least: 4.7 5 | Tested up to: 6.8.1 6 | Stable tag: 1.0.9 7 | License: GPLv2 or later 8 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 | 10 | A simple plugin to add the Multiple Taxonomy field. It allows you to select term(s) from multiple taxonomies. 11 | 12 | == Description == 13 | 14 | - This plugin adds the Multiple Taxonomy field as one of the Advanced Custom Fields (ACF). 15 | - The **Taxonomy** field in the ACF allows you to select term(s) from **only one taxonomy**. 16 | - The **Multiple Taxonomy** field allows you to select term(s) from **multiple taxonomies**. 17 | 18 | = Features = 19 | 20 | As with ACF's Taxonomy field: 21 | - You can select a term by radio buttons or a drop-down list. 22 | - You can select terms by checkboxes or a drop-down list. 23 | - 'Save Terms' option is supported. 24 | - 'Load Terms' option is supported. 25 | - 'Return Value' option is supported (Term Object or Term ID). 26 | 27 | Note: 'Create Terms' option is not supported. 28 | 29 | = Compatibility = 30 | 31 | This ACF field type is compatible with: 32 | * ACF 5 33 | 34 | = Link = 35 | 36 | * [Github](https://github.com/game-ryo/acf-multiple-taxonomy) 37 | 38 | == Installation == 39 | 40 | 1. Copy the `acf-multiple-taxonomy` folder into your `wp-content/plugins` folder 41 | 2. Activate the Multiple Taxonomy plugin via the plugins admin page 42 | 3. Create a new field via ACF and select the Multiple Taxonomy type 43 | 4. Read the description above for usage instructions 44 | 45 | == Changelog == 46 | 47 | = 1.0.9 = 48 | * Fixed AJAX issues that occurred when selecting terms. See [Github](https://github.com/game-ryo/acf-multiple-taxonomy/issues/3). 49 | 50 | = 1.0.8 = 51 | * Fixed AJAX verification error in ACF6.3.10. Thanks again to [justinmaurerdotdev](https://github.com/justinmaurerdotdev) for [his contribution](https://github.com/game-ryo/acf-multiple-taxonomy/pull/6). 52 | 53 | = 1.0.7 = 54 | * Fixed the AJAX handling compatibility issue introduced in ACF 6.3.2. Thanks to [justinmaurerdotdev](https://github.com/justinmaurerdotdev) for [his contribution](https://github.com/game-ryo/acf-multiple-taxonomy/pull/5). 55 | 56 | = 1.0.6 = 57 | * Removed the Stylized UI toggle button on the field settings screen. This option is now always on. 58 | 59 | = 1.0.5 = 60 | * Fixed serious errors that had occurred with the last update. I sincerely apologize to the users. 61 | 62 | = 1.0.4 = 63 | * Fixed performance issues with the grid view in the Media Library 64 | 65 | = 1.0.3 = 66 | * Fix warnings when invalid taxonomy is loaded 67 | 68 | = 1.0.2 = 69 | * Fix warnings when using radio/checkbox in php 8.0 70 | * Delete unnecessary css and js files 71 | 72 | = 1.0.1 = 73 | * Remove undefined variable which caused warning in php 8.0 74 | 75 | = 1.0.0 = 76 | * Initial Release. 77 | --------------------------------------------------------------------------------