Version Description
- TBD =
- Added: Support for
meta_box_cb
parameter forregister_taxonomy
and taxonomies. - Added: Dynamically warn about existing slugs.
- Added: "delete_with_user" support for post types.
- Added: Filters for post type and taxonomy data right before saving of final data.
- Added:
cptui_get_taxonomy_exists
function to check if a provided taxonomy is registered. - Added: Required PHP version to readme.txt
- Added: Filter on taxonomies to be listed as available for association with a post type.
- Added: Warning indicators to our "Slug changed" and "Slug exists" warnings for post types and taxonomies.
- Added: Support for "publicly_queryable" parameter for taxonomies.
- Added: Support for "rest_controller_class" parameters for both post types and taxonomies.
- Added: Some initial WP-CLI support for importing and exporting CPTUI settings.
- Added:
name_admin_bar
support in post type labels. - Added: Handling of array versions for "capability_type" field.
- Updated: Bump minimum WordPress version to 4.7.
- Updated: Pass the object_type array to
cptui_pre_register_taxonomy
filter as extra parameter. - Updated: Adjusted preserved label handling to aid with plugin performance. Props alex-solovyev
- Updated: Utilize
wp_doing_ajax()
function for our AJAX checks. - Updated: Clarify what is exported with the Post Types and Taxonomies spots for the Tools section.
- Updated: Clarify that the listed post types to associate to a CPTUI taxonomy are public post types by default.
- Updated: Make "Show In Rest" setting default to true for sake of easier Gutenberg integration in the future.
- Fixed: Only register archive slug if has_archive is set to true.
- Fixed: Error occurred when attempting to unset post types while editing a taxonomy.
- Fixed: Prevent errors from non-existant callback functions during post type or taxonomy processing.
- Fixed: Incorrect use of reserved taxonomy slugs function in a check for reserved post types.
- Fixed: Make sure "No post type selected" alert trigger from both buttons on the taxonomy settings edit screen.
- Fixed: Add our stylesheet only on our CPTUI pages. Fixes responsive bug on post editor screen.
- Fixed: Removed duplicate "label" in taxonomy "get code" section.
Download this release
Release Info
Developer | tw2113 |
Plugin | Custom Post Type UI |
Version | 1.6.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.8 to 1.6.0
- LICENSE +340 -0
- changelog.txt +0 -182
- classes/class.cptui_admin_ui.php +1 -0
- classes/class.cptui_debug_info.php +5 -3
- css/cptui.css +15 -4
- css/cptui.min.css +1 -1
- css/cptui.scss +31 -14
- custom-post-type-ui.php +959 -859
- images/wds_ads/cptui-extended.png +0 -0
- inc/about.php +29 -54
- inc/listings.php +50 -8
- inc/post-types.php +132 -63
- inc/support.php +17 -8
- inc/taxonomies.php +126 -46
- inc/tools.php +106 -55
- inc/utility.php +102 -13
- inc/wp-cli.php +107 -0
- js/cptui.js +16 -0
- js/cptui.min.js +1 -1
- readme.txt +64 -72
LICENSE
ADDED
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
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 |
+
{description}
|
294 |
+
Copyright (C) {year} {fullname}
|
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 |
+
{signature of Ty Coon}, 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 |
+
|
changelog.txt
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
= 1.3.5 - 2016-6-3 =
|
2 |
-
* Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
|
3 |
-
|
4 |
-
= 1.3.4 - 2016-5-4 =
|
5 |
-
* Fixed: moved WDS-based services "ads" to within the plugin itself. Will not request remote resources.
|
6 |
-
* Fixed: Better output formatting if WDS/Pluginize "ads" failed to load images.
|
7 |
-
* Fixed: undefined variable error in cptui.js
|
8 |
-
* Added: Newsletter subscription form to stay uptodate with Custom Post Type UI & Custom Post Type UI Extended news.
|
9 |
-
* Added: Support page/FAQ info regarding Pluginize and recent sidebar developments.
|
10 |
-
|
11 |
-
= 1.3.3 - 2016-4-5 =
|
12 |
-
* Revert Changes for ajax/heartbeat API requests before post type registration. 3rd party or other plugins were breaking because post types were not registered.
|
13 |
-
|
14 |
-
= 1.3.2 - 2016-4-5 =
|
15 |
-
* Fixed: Logic issue with cptui js files loading where they weren't meant to.
|
16 |
-
* Fixed: Required markers missing on required post type fields.
|
17 |
-
* Fixed: Removed excess labels that are not used by WordPress core.
|
18 |
-
* Added: New contributors to readme file. Welcome John and Ryan.
|
19 |
-
* Updated: New screenshot from 1.3.0 release. Moved to assets folder so users will no longer download as part of CPTUI.
|
20 |
-
* Updated: Better prevention of running our code during ajax/heartbeat api requests.
|
21 |
-
|
22 |
-
= 1.3.1 - 2016-3-25 =
|
23 |
-
* Fixed: Logic issue for default values of `public` parameter for taxonomies added in 1.3.0.
|
24 |
-
|
25 |
-
= 1.3.0 =
|
26 |
-
* Added: "CPTUI_VERSION" constant and deprecated "CPT_VERSION".
|
27 |
-
* Added: "Public" parameter for taxonomies
|
28 |
-
* Added: "View Post Types" and "View Taxonomies" tabs at top of add/edit screens.
|
29 |
-
* Added: Better prevention of potential duplicate slugs in new post types and taxonomies.
|
30 |
-
* Added: Current theme's textdomain as output in get code textareas.
|
31 |
-
* Added: Fill in singular and plural label fields if none provided. WordPress does not auto-fill these.
|
32 |
-
* Added: For developers: plenty of extra hooks all over for customization needs.
|
33 |
-
* Added: Javascript-based prevention of spaces and special characters for post type and taxonomy slugs.
|
34 |
-
* Added: Legend tag support to admin UI class.
|
35 |
-
* Added: Minified copies of our JavaScript and CSS. Define SCRIPT_DEBUG to true to use non-minified versions.
|
36 |
-
* Added: New post type and taxonomy labels provided by WordPress 4.3 and 4.4 releases.
|
37 |
-
* See: https://make.wordpress.org/core/2015/12/11/additional-labels-for-custom-post-types-and-custom-taxonomies/
|
38 |
-
* Added: Notes to post type and taxonomy edit screens about WordPress core's post types and taxonomies.
|
39 |
-
* Added: Taxonomy slug update ability with preserved term association.
|
40 |
-
* Added: Title, Editor, and Featured Image now checked by default for new post types.
|
41 |
-
* Added: "Show in Quick Edit" taxonomy parameter available in WP 4.2
|
42 |
-
* Added: Promo spots on add/edit screens for other products from WebDevStudios.
|
43 |
-
* Fixed: Need to visit permalinks page to flush rewrite rules after creating new post type or taxonomy.
|
44 |
-
* Fixed: Missing REST API based parameters in "Get Code" output.
|
45 |
-
* Updated: Increased accessibility coverage.
|
46 |
-
* Updated: Revised how tabs are added to pages so 3rd party developers can add their own tabs.
|
47 |
-
* Updated: Improved string consistency in our UI helper notes. Props @GaryJ
|
48 |
-
* Updated: Tested on WordPress 4.5
|
49 |
-
* Updated: Cleaned up admin footer area for social links.
|
50 |
-
* Updated: Moved all localization work to WordPress.org Translation packs
|
51 |
-
|
52 |
-
= 1.2.4 =
|
53 |
-
* Added: new CPTUI_VERSION constant to match naming of other current constants.
|
54 |
-
* Added: CPTUI_VERSION constant to cptui.css string for cache busting.
|
55 |
-
|
56 |
-
= 1.2.3 - 2016-01-31 =
|
57 |
-
* Fixed: copy/paste error with admin css. Props hinaloe.
|
58 |
-
|
59 |
-
= 1.2.2 - 2016-01-30 =
|
60 |
-
* Fixed: Missing admin menu icon for some browsers.
|
61 |
-
* Fixed: Undefined index notices for post type screen.
|
62 |
-
|
63 |
-
= 1.2.1 - 2016-01-17 =
|
64 |
-
* Fixed: Undefined index notices for custom taxonomies and new fields from 1.2.0
|
65 |
-
|
66 |
-
= 1.2.0 - 2016-01-15 =
|
67 |
-
* Added: Support for show_in_nav_menus parameter for post types.
|
68 |
-
* Added: Support for taxonomy descriptions.
|
69 |
-
* Added: Message on listings page if no post types or taxonomies are available.
|
70 |
-
* Added: Note regarding 'public' parameter not being true by default for WordPress but is for CPTUI.
|
71 |
-
* Added: Individual post type and taxonomy output for "Get Code" area.
|
72 |
-
* Added: Fallback values for post type/taxonomy select input and get code area if no plural label provided.
|
73 |
-
* Added: Support for custom query_var strings for post types.
|
74 |
-
* Added: Support for show_in_rest and rest_base for post types and taxonomies for the upcoming WordPress REST API.
|
75 |
-
* Added: Template hierarchy files to listings tables for user reference.
|
76 |
-
* Added: Form labels in more areas to help with accessibility and usability.
|
77 |
-
* Added: Fieldset method to Admin UI class for easily adding fieldset output.
|
78 |
-
* Added: Debugging tab for use with CPTUI support.
|
79 |
-
* Updated: Minimum version required. Now WordPress 4.2.
|
80 |
-
* Updated: Heading tags match accessibility changes in WordPress 4.3.
|
81 |
-
* Updated: Moved page title for some pages above tabs.
|
82 |
-
* Updated: Textdomain now matches WordPress.org repo slug.
|
83 |
-
* Updated: Added Visual Composer questions/answers to support section.
|
84 |
-
* Updated: Added question/answer regarding spaces in post type slugs
|
85 |
-
* Updated: Changed help icons to a Dashicon help icon.
|
86 |
-
* Fixed: Support for YARPP plugin.
|
87 |
-
* Fixed: Prevent potential issues with AJAX requests and our scripts/styles
|
88 |
-
|
89 |
-
= 1.1.3 - 2015-12-23 =
|
90 |
-
* Bumping WordPress compatibility version only. No other changes involved.
|
91 |
-
|
92 |
-
= 1.1.2 - 2015-08-11 =
|
93 |
-
* Change export value to plural label for taxonomies.
|
94 |
-
* Properly select a post type or taxonomy after deleting an existing value.
|
95 |
-
* Updated screenshots
|
96 |
-
* Added target="_blank" attribute to one of the inline help links for Menu position. Thanks @JulieKuehl
|
97 |
-
* Fixed potential XSS issue.
|
98 |
-
|
99 |
-
= 1.1.1 - 2015-06-15 =
|
100 |
-
* Re-add post type and taxonomy select buttons and only display for non-js users.
|
101 |
-
|
102 |
-
= 1.1.0 - 2015-06-12 =
|
103 |
-
* Simplified UI with regards to clicking amount.
|
104 |
-
* Auto selecting of first available post type or taxonomy in Edit tab.
|
105 |
-
* Switch to post type or taxonomy upon selection within Edit tab.
|
106 |
-
* Return of a list of CPTUI-registered post types and taxonomies.
|
107 |
-
* Post type slug update capability.
|
108 |
-
* Added function reference 3rd party link to support area.
|
109 |
-
* New hooks in edit screen for custom content display on screen.
|
110 |
-
* String updates.
|
111 |
-
* UI field option for custom "Supports" parameters from other plugins. Example: Yet Another Related Posts Plugin.
|
112 |
-
* Updated help/support section with another reference tool.
|
113 |
-
* Trim extra spaces potentially left behind in text inputs.
|
114 |
-
* Rearranged menu listing slightly to remove duplicate naming.
|
115 |
-
* GitHub repo has GitHub Updater (https://github.com/afragen/github-updater) compatible copy of CPTUI version that is available on WordPress.org
|
116 |
-
|
117 |
-
= 1.0.8 - 2015-05-01 =
|
118 |
-
* Register taxonomies at a higher priority than post types.
|
119 |
-
|
120 |
-
= 1.0.7 - 2015-04-20 =
|
121 |
-
* Preventive measures for potential XSS security issues with add_query_arg()
|
122 |
-
|
123 |
-
= 1.0.6 - 2015-04-14 =
|
124 |
-
* Change priority of post type registration function that was causing rewrite issues for many.
|
125 |
-
* Fix issues with help text spots not showing up for some post type fields. Props pedro-mendonca.
|
126 |
-
* Fix logic issue with PHP's empty() function and CPTUI 0.9.x saved settings.
|
127 |
-
|
128 |
-
= 1.0.5 - 2015-03-20 =
|
129 |
-
* Explicitly set the post type and taxonomy rewrite slugs as the registered slug if no custom ones provided.
|
130 |
-
* Prevent cptui.js from loading where it is not needed.
|
131 |
-
* Fixed undefined index notice for post type rewrite_withfront.
|
132 |
-
* Repopulated labels when none provided and post type or taxonomy mentioned in default label.
|
133 |
-
* Fix for import/export get code tab and hierarchical taxonomies
|
134 |
-
|
135 |
-
= 1.0.4 - 2015-03-05 =
|
136 |
-
* Fixed incorrect boolean order for hierarchical taxonomies and default value.
|
137 |
-
* Fixed missing closing div tags.
|
138 |
-
* Default menu position to null instead of empty string.
|
139 |
-
* Undefined index notice cleanup.
|
140 |
-
* Remove unnecessary hook.
|
141 |
-
|
142 |
-
= 1.0.3 - Unknown =
|
143 |
-
* Fix logic error regarding string "0" evaluating to false when checked for not empty.
|
144 |
-
* Fix for taxonomy with_front boolean value not evaluating correctly.
|
145 |
-
* Fix for taxonomy hierarchical boolean value not evaluating correctly.
|
146 |
-
* Fix for post type has_archive.
|
147 |
-
* German translation updates. If you speak/read German, myself and the translator would LOVE to have feedback on this.
|
148 |
-
* Internationalization string changes after feedback from German translation work.
|
149 |
-
* Minor issue with link html being stripped from UI field explanation.
|
150 |
-
* Better apostrophe/single quote support in label fields.
|
151 |
-
|
152 |
-
= 1.0.2 - 2015-02-12 =
|
153 |
-
* Fix issue with checked checkboxes for post type associations for taxonomies.
|
154 |
-
* Fix "Get Code" spot related to post type associations for taxonomies.
|
155 |
-
* Update some text strings after localization feedback.
|
156 |
-
* Fix typos in textdomain for two spots.
|
157 |
-
* Updating progressing translation files.
|
158 |
-
* Fix value for with_front parameter.
|
159 |
-
* Fix error in boolean type for map_meta_cap.
|
160 |
-
* Fix missing use of query_var slug if present for taxonomies.
|
161 |
-
|
162 |
-
= 1.0.1 - 2015-02-11 =
|
163 |
-
* Fix issues with taxonomy transfer and registration.
|
164 |
-
* Fix issue with taxonomy "show admin column" evaluating to true regardless of setting.
|
165 |
-
* Prefix our "help" class to prevent conflict with other plugins that use just "help".
|
166 |
-
* Fix issue with menu position values not being obeyed.
|
167 |
-
* Fix hook names inside taxonomy update function.
|
168 |
-
* Fix potentially empty parameter with taxonomies and "Get Code" output.
|
169 |
-
* Added PHP "undefined index" notice prevention for some parameters.
|
170 |
-
|
171 |
-
= 1.0.0 - 2015-02-09 =
|
172 |
-
* CPTUI has been given a new UI!
|
173 |
-
* Separated out post type and taxonomy creation to their own screens.
|
174 |
-
* Added import/export ability for post type and taxonomy settings.
|
175 |
-
* Added a Help/Support Screen.
|
176 |
-
* Added/Updated available parameters for post types and parameters.
|
177 |
-
* Updated i18n and translation files.
|
178 |
-
* Added Confirmation prompts before deleting post types and taxonomies.
|
179 |
-
* Added actions and filters for 3rd party customization.
|
180 |
-
* Added function that automatically converts 0.8.x and down settings to new setting arrangement.
|
181 |
-
* Changed how settings are stored so that post types and taxonomies are in named array indexes.
|
182 |
-
* Bug fixes not mentioned above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/class.cptui_admin_ui.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage AdminUI
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
|
|
9 |
*/
|
10 |
|
11 |
/**
|
6 |
* @subpackage AdminUI
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
/**
|
classes/class.cptui_debug_info.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage Debugging
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.2.0
|
|
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -145,13 +146,13 @@ class CPTUI_Debug_Info {
|
|
145 |
echo "\n";
|
146 |
$cptui_post_types = cptui_get_post_type_data();
|
147 |
echo "\t\t" . 'Post Types: ' . "\n";
|
148 |
-
echo "\t\t" .
|
149 |
|
150 |
echo "\n\n";
|
151 |
|
152 |
$cptui_taxonomies = cptui_get_taxonomy_data();
|
153 |
echo "\t\t" . 'Taxonomies: ' . "\n";
|
154 |
-
echo "\t\t" .
|
155 |
echo "\n";
|
156 |
|
157 |
if ( has_action( 'cptui_custom_debug_info' ) ) {
|
@@ -229,7 +230,8 @@ class CPTUI_Debug_Info {
|
|
229 |
* @param string $value Intended email subject.
|
230 |
*/
|
231 |
$subject = apply_filters( 'cptui_debug_email_subject', sprintf(
|
232 |
-
|
|
|
233 |
home_url( '/' )
|
234 |
) );
|
235 |
|
6 |
* @subpackage Debugging
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.2.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
/**
|
146 |
echo "\n";
|
147 |
$cptui_post_types = cptui_get_post_type_data();
|
148 |
echo "\t\t" . 'Post Types: ' . "\n";
|
149 |
+
echo "\t\t" . json_encode( $cptui_post_types ) . "\n";
|
150 |
|
151 |
echo "\n\n";
|
152 |
|
153 |
$cptui_taxonomies = cptui_get_taxonomy_data();
|
154 |
echo "\t\t" . 'Taxonomies: ' . "\n";
|
155 |
+
echo "\t\t" . json_encode( $cptui_taxonomies ) . "\n";
|
156 |
echo "\n";
|
157 |
|
158 |
if ( has_action( 'cptui_custom_debug_info' ) ) {
|
230 |
* @param string $value Intended email subject.
|
231 |
*/
|
232 |
$subject = apply_filters( 'cptui_debug_email_subject', sprintf(
|
233 |
+
// translators: Placeholder will hold site home_url.
|
234 |
+
__( 'Custom Post Type UI debug information for %s', 'custom-post-type-ui' ),
|
235 |
home_url( '/' )
|
236 |
) );
|
237 |
|
css/cptui.css
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
width: auto;
|
40 |
}
|
41 |
|
42 |
-
.cptui-table td.
|
43 |
vertical-align: top;
|
44 |
width: 50%;
|
45 |
}
|
@@ -63,15 +63,19 @@
|
|
63 |
margin-top: 15px;
|
64 |
}
|
65 |
|
66 |
-
.cptui-table #slugchanged {
|
67 |
color: red;
|
68 |
font-weight: bold;
|
69 |
}
|
70 |
|
71 |
-
.cptui-table #slugchanged.hidemessage {
|
72 |
display: none;
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
75 |
.cptui-support #support .question {
|
76 |
font-size: 18px;
|
77 |
font-weight: bold;
|
@@ -377,7 +381,7 @@ fieldset .cptui-help {
|
|
377 |
min-width: 463px;
|
378 |
}
|
379 |
|
380 |
-
@media screen and (min-width:
|
381 |
.cptui-badge {
|
382 |
padding-top: 142px;
|
383 |
height: 50px;
|
@@ -408,4 +412,11 @@ fieldset .cptui-help {
|
|
408 |
.wdspromos-about p:nth-child(4) {
|
409 |
padding-right: 5px;
|
410 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
}
|
39 |
width: auto;
|
40 |
}
|
41 |
|
42 |
+
.cptui-table td.outer {
|
43 |
vertical-align: top;
|
44 |
width: 50%;
|
45 |
}
|
63 |
margin-top: 15px;
|
64 |
}
|
65 |
|
66 |
+
.cptui-table #slugchanged, .cptui-table #slugexists {
|
67 |
color: red;
|
68 |
font-weight: bold;
|
69 |
}
|
70 |
|
71 |
+
.cptui-table #slugchanged.hidemessage, .cptui-table #slugexists.hidemessage {
|
72 |
display: none;
|
73 |
}
|
74 |
|
75 |
+
.cpt-ui_page_cptui_tools .cptui-table .outer p {
|
76 |
+
padding: 0 4px;
|
77 |
+
}
|
78 |
+
|
79 |
.cptui-support #support .question {
|
80 |
font-size: 18px;
|
81 |
font-weight: bold;
|
381 |
min-width: 463px;
|
382 |
}
|
383 |
|
384 |
+
@media screen and (min-width: 769px) {
|
385 |
.cptui-badge {
|
386 |
padding-top: 142px;
|
387 |
height: 50px;
|
412 |
.wdspromos-about p:nth-child(4) {
|
413 |
padding-right: 5px;
|
414 |
}
|
415 |
+
.cptui-table td.outer {
|
416 |
+
width: 100%;
|
417 |
+
}
|
418 |
+
#cptui-audit-textarea,
|
419 |
+
#cptui_debug_info_email {
|
420 |
+
width: 100%;
|
421 |
+
}
|
422 |
}
|
css/cptui.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.
|
1 |
+
.posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical;width:100%}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important}.about-wrap .cptui-badge{position:absolute;top:0;right:0}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-section fieldset{border:1px solid #ccc;display:block;margin-bottom:30px;padding:10px;overflow:hidden}.js .cptui-section fieldset.toggledclosed{height:1px}.cptui-section legend{border:1px solid #ccc;border-bottom:0;font-size:14px;font-weight:700;padding:5px}.cptui-spacer{display:block;margin-top:25px}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos #mc_embed_signup{background:#fff;border:1px solid #ccc;clear:left;margin-bottom:10px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin:0 -5px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui-audit-textarea,#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
|
css/cptui.scss
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
$min-tablet: "screen and (min-width:
|
2 |
$max-tablet: "screen and (max-width: 768px)";
|
3 |
|
4 |
.posttypesui, .taxonomiesui {
|
@@ -35,7 +35,7 @@ $max-tablet: "screen and (max-width: 768px)";
|
|
35 |
margin: 12px 4px 12px 0;
|
36 |
width: auto;
|
37 |
}
|
38 |
-
td.
|
39 |
vertical-align: top;
|
40 |
width: 50%;
|
41 |
}
|
@@ -55,7 +55,7 @@ $max-tablet: "screen and (max-width: 768px)";
|
|
55 |
margin-top: 15px;
|
56 |
}
|
57 |
|
58 |
-
#slugchanged {
|
59 |
color: red;
|
60 |
font-weight: bold;
|
61 |
&.hidemessage {
|
@@ -63,6 +63,15 @@ $max-tablet: "screen and (max-width: 768px)";
|
|
63 |
}
|
64 |
}
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
.cptui-support #support {
|
68 |
.question {
|
@@ -330,15 +339,14 @@ $max-tablet: "screen and (max-width: 768px)";
|
|
330 |
-ms-flex-item-align: auto;
|
331 |
align-self: auto;
|
332 |
}
|
333 |
-
|
334 |
p {
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
}
|
343 |
}
|
344 |
.no-js {
|
@@ -381,9 +389,9 @@ $max-tablet: "screen and (max-width: 768px)";
|
|
381 |
|
382 |
@media #{$max-tablet} {
|
383 |
.cptui-table {
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
}
|
388 |
.wdspromos-about {
|
389 |
flex-wrap: wrap;
|
@@ -397,4 +405,13 @@ $max-tablet: "screen and (max-width: 768px)";
|
|
397 |
}
|
398 |
}
|
399 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
}
|
1 |
+
$min-tablet: "screen and (min-width: 769px)";
|
2 |
$max-tablet: "screen and (max-width: 768px)";
|
3 |
|
4 |
.posttypesui, .taxonomiesui {
|
35 |
margin: 12px 4px 12px 0;
|
36 |
width: auto;
|
37 |
}
|
38 |
+
td.outer {
|
39 |
vertical-align: top;
|
40 |
width: 50%;
|
41 |
}
|
55 |
margin-top: 15px;
|
56 |
}
|
57 |
|
58 |
+
#slugchanged, #slugexists {
|
59 |
color: red;
|
60 |
font-weight: bold;
|
61 |
&.hidemessage {
|
63 |
}
|
64 |
}
|
65 |
}
|
66 |
+
.cpt-ui_page_cptui_tools {
|
67 |
+
.cptui-table {
|
68 |
+
.outer {
|
69 |
+
p {
|
70 |
+
padding: 0 4px;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
|
76 |
.cptui-support #support {
|
77 |
.question {
|
339 |
-ms-flex-item-align: auto;
|
340 |
align-self: auto;
|
341 |
}
|
|
|
342 |
p {
|
343 |
+
padding: 0 5px;
|
344 |
+
&:nth-child(1) {
|
345 |
+
padding-left: 0px;
|
346 |
+
}
|
347 |
+
&:nth-child(4) {
|
348 |
+
padding-right: 0px;
|
349 |
+
}
|
350 |
}
|
351 |
}
|
352 |
.no-js {
|
389 |
|
390 |
@media #{$max-tablet} {
|
391 |
.cptui-table {
|
392 |
+
#description {
|
393 |
+
width: 100%;
|
394 |
+
}
|
395 |
}
|
396 |
.wdspromos-about {
|
397 |
flex-wrap: wrap;
|
405 |
}
|
406 |
}
|
407 |
}
|
408 |
+
.cptui-table {
|
409 |
+
td.outer {
|
410 |
+
width: 100%;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
#cptui-audit-textarea,
|
414 |
+
#cptui_debug_info_email {
|
415 |
+
width: 100%;
|
416 |
+
}
|
417 |
}
|
custom-post-type-ui.php
CHANGED
@@ -1,859 +1,959 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Custom Post Type UI.
|
4 |
-
*
|
5 |
-
* For all your post type and taxonomy needs.
|
6 |
-
*
|
7 |
-
* @package CPTUI
|
8 |
-
* @subpackage Loader
|
9 |
-
* @author WebDevStudios
|
10 |
-
* @since 0.1.0.0
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
Plugin
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
Domain
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
define( '
|
32 |
-
define( '
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
require_once( plugin_dir_path( __FILE__ ) . 'classes/class.
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
*
|
50 |
-
*
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
if
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
*
|
66 |
-
*
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
if
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
*
|
98 |
-
*
|
99 |
-
*
|
100 |
-
*
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
*
|
110 |
-
*
|
111 |
-
*
|
112 |
-
*
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
*
|
122 |
-
*
|
123 |
-
*
|
124 |
-
*
|
125 |
-
*
|
126 |
-
*
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
*
|
133 |
-
*
|
134 |
-
*
|
135 |
-
*
|
136 |
-
|
137 |
-
|
138 |
-
$
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
add_submenu_page( $parent_slug, __( 'Add/Edit
|
143 |
-
add_submenu_page( $parent_slug, __( '
|
144 |
-
add_submenu_page( $parent_slug, __( '
|
145 |
-
add_submenu_page( $parent_slug, __( '
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
*
|
150 |
-
*
|
151 |
-
*
|
152 |
-
*
|
153 |
-
* @param string $
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
*
|
166 |
-
*
|
167 |
-
*
|
168 |
-
*
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
*
|
175 |
-
*
|
176 |
-
*
|
177 |
-
*
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
*
|
186 |
-
*
|
187 |
-
*
|
188 |
-
*
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/
|
193 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/
|
194 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/
|
195 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/
|
196 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/
|
197 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
}
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
*
|
284 |
-
*
|
285 |
-
* @
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
*
|
296 |
-
*
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
*
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
if ( ! empty( $
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
$
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
$
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
}
|
376 |
-
|
377 |
-
$
|
378 |
-
|
379 |
-
|
380 |
-
$
|
381 |
-
|
382 |
-
|
383 |
-
$
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
$
|
396 |
-
}
|
397 |
-
|
398 |
-
$
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
$post_type['
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
'
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
*
|
473 |
-
*
|
474 |
-
*
|
475 |
-
* @
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
$
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
'
|
577 |
-
|
578 |
-
|
579 |
-
'
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
);
|
589 |
-
|
590 |
-
$
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
$
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
$
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
'
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
'
|
797 |
-
|
798 |
-
'
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
'
|
803 |
-
|
804 |
-
'
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
'
|
843 |
-
'
|
844 |
-
'
|
845 |
-
'
|
846 |
-
'
|
847 |
-
'
|
848 |
-
'
|
849 |
-
'
|
850 |
-
'
|
851 |
-
|
852 |
-
|
853 |
-
'
|
854 |
-
'
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom Post Type UI.
|
4 |
+
*
|
5 |
+
* For all your post type and taxonomy needs.
|
6 |
+
*
|
7 |
+
* @package CPTUI
|
8 |
+
* @subpackage Loader
|
9 |
+
* @author WebDevStudios
|
10 |
+
* @since 0.1.0.0
|
11 |
+
* @license GPL-2.0+
|
12 |
+
*/
|
13 |
+
|
14 |
+
/*
|
15 |
+
Plugin Name: Custom Post Type UI
|
16 |
+
Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
|
17 |
+
Description: Admin panel for creating custom post types and custom taxonomies in WordPress
|
18 |
+
Author: WebDevStudios
|
19 |
+
Version: 1.6.0
|
20 |
+
Author URI: https://webdevstudios.com/
|
21 |
+
Text Domain: custom-post-type-ui
|
22 |
+
Domain Path: /languages
|
23 |
+
License: GPL-2.0+
|
24 |
+
*/
|
25 |
+
|
26 |
+
// Exit if accessed directly.
|
27 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
28 |
+
exit;
|
29 |
+
}
|
30 |
+
|
31 |
+
define( 'CPT_VERSION', '1.6.0' ); // Left for legacy purposes.
|
32 |
+
define( 'CPTUI_VERSION', '1.6.0' );
|
33 |
+
define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Load our Admin UI class that powers our form inputs.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @internal
|
41 |
+
*/
|
42 |
+
function cptui_load_ui_class() {
|
43 |
+
require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_admin_ui.php' );
|
44 |
+
require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_debug_info.php' );
|
45 |
+
}
|
46 |
+
add_action( 'init', 'cptui_load_ui_class' );
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Set a transient used for redirection upon activation.
|
50 |
+
*
|
51 |
+
* @since 1.4.0
|
52 |
+
*/
|
53 |
+
function cptui_activation_redirect() {
|
54 |
+
// Bail if activating from network, or bulk.
|
55 |
+
if ( is_network_admin() ) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
// Add the transient to redirect.
|
60 |
+
set_transient( 'cptui_activation_redirect', true, 30 );
|
61 |
+
}
|
62 |
+
add_action( 'activate_' . plugin_basename( __FILE__ ), 'cptui_activation_redirect' );
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Redirect user to CPTUI about page upon plugin activation.
|
66 |
+
*
|
67 |
+
* @since 1.4.0
|
68 |
+
*/
|
69 |
+
function cptui_make_activation_redirect() {
|
70 |
+
|
71 |
+
if ( ! get_transient( 'cptui_activation_redirect' ) ) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
|
75 |
+
delete_transient( 'cptui_activation_redirect' );
|
76 |
+
|
77 |
+
// Bail if activating from network, or bulk.
|
78 |
+
if ( is_network_admin() ) {
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( ! cptui_is_new_install() ) {
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
|
86 |
+
// Redirect to CPTUI about page.
|
87 |
+
wp_safe_redirect(
|
88 |
+
add_query_arg(
|
89 |
+
array( 'page' => 'cptui_main_menu' ),
|
90 |
+
cptui_admin_url( 'admin.php?page=cptui_main_menu' )
|
91 |
+
)
|
92 |
+
);
|
93 |
+
}
|
94 |
+
add_action( 'admin_init', 'cptui_make_activation_redirect', 1 );
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Flush our rewrite rules on deactivation.
|
98 |
+
*
|
99 |
+
* @since 0.8.0
|
100 |
+
*
|
101 |
+
* @internal
|
102 |
+
*/
|
103 |
+
function cptui_deactivation() {
|
104 |
+
flush_rewrite_rules();
|
105 |
+
}
|
106 |
+
register_deactivation_hook( __FILE__, 'cptui_deactivation' );
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Register our text domain.
|
110 |
+
*
|
111 |
+
* @since 0.8.0
|
112 |
+
*
|
113 |
+
* @internal
|
114 |
+
*/
|
115 |
+
function cptui_load_textdomain() {
|
116 |
+
load_plugin_textdomain( 'custom-post-type-ui' );
|
117 |
+
}
|
118 |
+
add_action( 'plugins_loaded', 'cptui_load_textdomain' );
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Load our main menu.
|
122 |
+
*
|
123 |
+
* Submenu items added in version 1.1.0
|
124 |
+
*
|
125 |
+
* @since 0.1.0
|
126 |
+
*
|
127 |
+
* @internal
|
128 |
+
*/
|
129 |
+
function cptui_plugin_menu() {
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Filters the required capability to manage CPTUI settings.
|
133 |
+
*
|
134 |
+
* @since 1.3.0
|
135 |
+
*
|
136 |
+
* @param string $value Capability required.
|
137 |
+
*/
|
138 |
+
$capability = apply_filters( 'cptui_required_capabilities', 'manage_options' );
|
139 |
+
$parent_slug = 'cptui_main_menu';
|
140 |
+
|
141 |
+
add_menu_page( __( 'Custom Post Types', 'custom-post-type-ui' ), __( 'CPT UI', 'custom-post-type-ui' ), $capability, $parent_slug, 'cptui_settings', cptui_menu_icon() );
|
142 |
+
add_submenu_page( $parent_slug, __( 'Add/Edit Post Types', 'custom-post-type-ui' ), __( 'Add/Edit Post Types', 'custom-post-type-ui' ), $capability, 'cptui_manage_post_types', 'cptui_manage_post_types' );
|
143 |
+
add_submenu_page( $parent_slug, __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), $capability, 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
|
144 |
+
add_submenu_page( $parent_slug, __( 'Registered Types and Taxes', 'custom-post-type-ui' ), __( 'Registered Types/Taxes', 'custom-post-type-ui' ), $capability, 'cptui_listings', 'cptui_listings' );
|
145 |
+
add_submenu_page( $parent_slug, __( 'Custom Post Type UI Tools', 'custom-post-type-ui' ), __( 'Tools', 'custom-post-type-ui' ), $capability, 'cptui_tools', 'cptui_tools' );
|
146 |
+
add_submenu_page( $parent_slug, __( 'Help/Support', 'custom-post-type-ui' ), __( 'Help/Support', 'custom-post-type-ui' ), $capability, 'cptui_support', 'cptui_support' );
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Fires after the default submenu pages.
|
150 |
+
*
|
151 |
+
* @since 1.3.0
|
152 |
+
*
|
153 |
+
* @param string $value Parent slug for Custom Post Type UI menu.
|
154 |
+
* @param string $capability Capability required to manage CPTUI settings.
|
155 |
+
*/
|
156 |
+
do_action( 'cptui_extra_menu_items', $parent_slug, $capability );
|
157 |
+
|
158 |
+
// Remove the default one so we can add our customized version.
|
159 |
+
remove_submenu_page( $parent_slug, 'cptui_main_menu' );
|
160 |
+
add_submenu_page( $parent_slug, __( 'About CPT UI', 'custom-post-type-ui' ), __( 'About CPT UI', 'custom-post-type-ui' ), $capability, 'cptui_main_menu', 'cptui_settings' );
|
161 |
+
}
|
162 |
+
add_action( 'admin_menu', 'cptui_plugin_menu' );
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Fire our CPTUI Loaded hook.
|
166 |
+
*
|
167 |
+
* @since 1.3.0
|
168 |
+
*
|
169 |
+
* @internal Use `cptui_loaded` hook.
|
170 |
+
*/
|
171 |
+
function cptui_loaded() {
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Fires upon plugins_loaded WordPress hook.
|
175 |
+
*
|
176 |
+
* CPTUI loads its required files on this hook.
|
177 |
+
*
|
178 |
+
* @since 1.3.0
|
179 |
+
*/
|
180 |
+
do_action( 'cptui_loaded' );
|
181 |
+
}
|
182 |
+
add_action( 'plugins_loaded', 'cptui_loaded' );
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Load our submenus.
|
186 |
+
*
|
187 |
+
* @since 1.0.0
|
188 |
+
*
|
189 |
+
* @internal
|
190 |
+
*/
|
191 |
+
function cptui_create_submenus() {
|
192 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/about.php' );
|
193 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/utility.php' );
|
194 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
|
195 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
|
196 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
|
197 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/tools.php' );
|
198 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
|
199 |
+
|
200 |
+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
201 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/wp-cli.php' );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
add_action( 'cptui_loaded', 'cptui_create_submenus' );
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Fire our CPTUI init hook.
|
208 |
+
*
|
209 |
+
* @since 1.3.0
|
210 |
+
*
|
211 |
+
* @internal Use `cptui_init` hook.
|
212 |
+
*/
|
213 |
+
function cptui_init() {
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Fires upon init WordPress hook.
|
217 |
+
*
|
218 |
+
* @since 1.3.0
|
219 |
+
*/
|
220 |
+
do_action( 'cptui_init' );
|
221 |
+
}
|
222 |
+
add_action( 'init', 'cptui_init' );
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Enqueue CPTUI admin styles.
|
226 |
+
*
|
227 |
+
* @since 1.0.0
|
228 |
+
*
|
229 |
+
* @internal
|
230 |
+
*/
|
231 |
+
function cptui_add_styles() {
|
232 |
+
if ( wp_doing_ajax() ) {
|
233 |
+
return;
|
234 |
+
}
|
235 |
+
|
236 |
+
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
237 |
+
wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), array( 'jquery', 'postbox' ), CPTUI_VERSION, true );
|
238 |
+
wp_register_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), array(), CPTUI_VERSION );
|
239 |
+
}
|
240 |
+
add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Register our users' custom post types.
|
244 |
+
*
|
245 |
+
* @since 0.5.0
|
246 |
+
*
|
247 |
+
* @internal
|
248 |
+
*/
|
249 |
+
function cptui_create_custom_post_types() {
|
250 |
+
$cpts = get_option( 'cptui_post_types' );
|
251 |
+
|
252 |
+
if ( empty( $cpts ) ) {
|
253 |
+
return;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Fires before the start of the post type registrations.
|
258 |
+
*
|
259 |
+
* @since 1.3.0
|
260 |
+
*
|
261 |
+
* @param array $cpts Array of post types to register.
|
262 |
+
*/
|
263 |
+
do_action( 'cptui_pre_register_post_types', $cpts );
|
264 |
+
|
265 |
+
if ( is_array( $cpts ) ) {
|
266 |
+
foreach ( $cpts as $post_type ) {
|
267 |
+
cptui_register_single_post_type( $post_type );
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Fires after the completion of the post type registrations.
|
273 |
+
*
|
274 |
+
* @since 1.3.0
|
275 |
+
*
|
276 |
+
* @param array $cpts Array of post types registered.
|
277 |
+
*/
|
278 |
+
do_action( 'cptui_post_register_post_types', $cpts );
|
279 |
+
}
|
280 |
+
add_action( 'init', 'cptui_create_custom_post_types', 10 ); // Leave on standard init for legacy purposes.
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Helper function to register the actual post_type.
|
284 |
+
*
|
285 |
+
* @since 1.0.0
|
286 |
+
*
|
287 |
+
* @internal
|
288 |
+
*
|
289 |
+
* @param array $post_type Post type array to register. Optional.
|
290 |
+
* @return null Result of register_post_type.
|
291 |
+
*/
|
292 |
+
function cptui_register_single_post_type( $post_type = array() ) {
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Filters the map_meta_cap value.
|
296 |
+
*
|
297 |
+
* @since 1.0.0
|
298 |
+
*
|
299 |
+
* @param bool $value True.
|
300 |
+
* @param string $name Post type name being registered.
|
301 |
+
* @param array $post_type All parameters for post type registration.
|
302 |
+
*/
|
303 |
+
$post_type['map_meta_cap'] = apply_filters( 'cptui_map_meta_cap', true, $post_type['name'], $post_type );
|
304 |
+
|
305 |
+
if ( empty( $post_type['supports'] ) ) {
|
306 |
+
$post_type['supports'] = array();
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Filters custom supports parameters for 3rd party plugins.
|
311 |
+
*
|
312 |
+
* @since 1.0.0
|
313 |
+
*
|
314 |
+
* @param array $value Empty array to add supports keys to.
|
315 |
+
* @param string $name Post type slug being registered.
|
316 |
+
* @param array $post_type Array of post type arguments to be registered.
|
317 |
+
*/
|
318 |
+
$user_supports_params = apply_filters( 'cptui_user_supports_params', array(), $post_type['name'], $post_type );
|
319 |
+
|
320 |
+
if ( is_array( $user_supports_params ) && ! empty( $user_supports_params ) ) {
|
321 |
+
if ( is_array( $post_type['supports'] ) ) {
|
322 |
+
$post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
|
323 |
+
} else {
|
324 |
+
$post_type['supports'] = array( $user_supports_params );
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
$yarpp = false; // Prevent notices.
|
329 |
+
if ( ! empty( $post_type['custom_supports'] ) ) {
|
330 |
+
$custom = explode( ',', $post_type['custom_supports'] );
|
331 |
+
foreach ( $custom as $part ) {
|
332 |
+
// We'll handle YARPP separately.
|
333 |
+
if ( in_array( $part, array( 'YARPP', 'yarpp' ) ) ) {
|
334 |
+
$yarpp = true;
|
335 |
+
continue;
|
336 |
+
}
|
337 |
+
$post_type['supports'][] = trim( $part );
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
if ( isset( $post_type['supports'] ) && is_array( $post_type['supports'] ) && in_array( 'none', $post_type['supports'] ) ) {
|
342 |
+
$post_type['supports'] = false;
|
343 |
+
}
|
344 |
+
|
345 |
+
$labels = array(
|
346 |
+
'name' => $post_type['label'],
|
347 |
+
'singular_name' => $post_type['singular_label'],
|
348 |
+
);
|
349 |
+
|
350 |
+
$preserved = cptui_get_preserved_keys( 'post_types' );
|
351 |
+
$preserved_labels = cptui_get_preserved_labels();
|
352 |
+
foreach ( $post_type['labels'] as $key => $label ) {
|
353 |
+
|
354 |
+
if ( ! empty( $label ) ) {
|
355 |
+
if ( 'parent' === $key ) {
|
356 |
+
$labels['parent_item_colon'] = $label;
|
357 |
+
} else {
|
358 |
+
$labels[ $key ] = $label;
|
359 |
+
}
|
360 |
+
} elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
|
361 |
+
$singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['post_types']['plural'] ) ) ) ? 'plural' : 'singular';
|
362 |
+
$label_plurality = ( 'plural' === $singular_or_plural ) ? $post_type['label'] : $post_type['singular_label'];
|
363 |
+
$labels[ $key ] = sprintf( $preserved_labels['post_types'][ $singular_or_plural ][ $key ], $label_plurality );
|
364 |
+
}
|
365 |
+
}
|
366 |
+
|
367 |
+
$has_archive = ( isset( $post_type['has_archive'] ) ) ? get_disp_boolean( $post_type['has_archive'] ) : false;
|
368 |
+
if ( $has_archive && ! empty( $post_type['has_archive_string'] ) ) {
|
369 |
+
$has_archive = $post_type['has_archive_string'];
|
370 |
+
}
|
371 |
+
|
372 |
+
$show_in_menu = get_disp_boolean( $post_type['show_in_menu'] );
|
373 |
+
if ( ! empty( $post_type['show_in_menu_string'] ) ) {
|
374 |
+
$show_in_menu = $post_type['show_in_menu_string'];
|
375 |
+
}
|
376 |
+
|
377 |
+
$rewrite = get_disp_boolean( $post_type['rewrite'] );
|
378 |
+
if ( false !== $rewrite ) {
|
379 |
+
// Core converts to an empty array anyway, so safe to leave this instead of passing in boolean true.
|
380 |
+
$rewrite = array();
|
381 |
+
$rewrite['slug'] = ( ! empty( $post_type['rewrite_slug'] ) ) ? $post_type['rewrite_slug'] : $post_type['name'];
|
382 |
+
|
383 |
+
$rewrite['with_front'] = true; // Default value.
|
384 |
+
if ( isset( $post_type['rewrite_withfront'] ) ) {
|
385 |
+
$rewrite['with_front'] = ( 'false' === disp_boolean( $post_type['rewrite_withfront'] ) ) ? false : true;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
$menu_icon = ( ! empty( $post_type['menu_icon'] ) ) ? $post_type['menu_icon'] : null;
|
390 |
+
|
391 |
+
if ( in_array( $post_type['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
|
392 |
+
$post_type['query_var'] = get_disp_boolean( $post_type['query_var'] );
|
393 |
+
}
|
394 |
+
if ( ! empty( $post_type['query_var_slug'] ) ) {
|
395 |
+
$post_type['query_var'] = $post_type['query_var_slug'];
|
396 |
+
}
|
397 |
+
|
398 |
+
$menu_position = null;
|
399 |
+
if ( ! empty( $post_type['menu_position'] ) ) {
|
400 |
+
$menu_position = (int) $post_type['menu_position'];
|
401 |
+
}
|
402 |
+
|
403 |
+
$capability_type = 'post';
|
404 |
+
if ( ! empty( $post_type['capability_type'] ) ) {
|
405 |
+
$capability_type = $post_type['capability_type'];
|
406 |
+
if ( false !== strpos( $post_type['capability_type'], ',' ) ) {
|
407 |
+
$caps = array_map( 'trim', explode( ',', $post_type['capability_type'] ) );
|
408 |
+
if ( count( $caps ) > 2 ) {
|
409 |
+
$caps = array_slice( $caps, 0, 2 );
|
410 |
+
}
|
411 |
+
$capability_type = $caps;
|
412 |
+
}
|
413 |
+
}
|
414 |
+
|
415 |
+
$public = get_disp_boolean( $post_type['public'] );
|
416 |
+
if ( ! empty( $post_type['exclude_from_search'] ) ) {
|
417 |
+
$exclude_from_search = get_disp_boolean( $post_type['exclude_from_search'] );
|
418 |
+
} else {
|
419 |
+
$exclude_from_search = ( false === $public ) ? true : false;
|
420 |
+
}
|
421 |
+
|
422 |
+
$queryable = ( ! empty( $post_type['publicly_queryable'] ) && isset( $post_type['publicly_queryable'] ) ) ? get_disp_boolean( $post_type['publicly_queryable'] ) : $public;
|
423 |
+
|
424 |
+
if ( empty( $post_type['show_in_nav_menus'] ) ) {
|
425 |
+
// Defaults to value of public.
|
426 |
+
$post_type['show_in_nav_menus'] = $public;
|
427 |
+
}
|
428 |
+
|
429 |
+
if ( empty( $post_type['show_in_rest'] ) ) {
|
430 |
+
$post_type['show_in_rest'] = false;
|
431 |
+
}
|
432 |
+
|
433 |
+
$rest_base = null;
|
434 |
+
if ( ! empty( $post_type['rest_base'] ) ) {
|
435 |
+
$rest_base = $post_type['rest_base'];
|
436 |
+
}
|
437 |
+
|
438 |
+
$rest_controller_class = null;
|
439 |
+
if ( ! empty( $post_type['rest_controller_class'] ) ) {
|
440 |
+
$rest_controller_class = $post_type['rest_controller_class'];
|
441 |
+
}
|
442 |
+
|
443 |
+
$args = array(
|
444 |
+
'labels' => $labels,
|
445 |
+
'description' => $post_type['description'],
|
446 |
+
'public' => get_disp_boolean( $post_type['public'] ),
|
447 |
+
'publicly_queryable' => $queryable,
|
448 |
+
'show_ui' => get_disp_boolean( $post_type['show_ui'] ),
|
449 |
+
'show_in_nav_menus' => get_disp_boolean( $post_type['show_in_nav_menus'] ),
|
450 |
+
'has_archive' => $has_archive,
|
451 |
+
'show_in_menu' => $show_in_menu,
|
452 |
+
'show_in_rest' => get_disp_boolean( $post_type['show_in_rest'] ),
|
453 |
+
'rest_base' => $rest_base,
|
454 |
+
'rest_controller_class' => $rest_controller_class,
|
455 |
+
'exclude_from_search' => $exclude_from_search,
|
456 |
+
'capability_type' => $capability_type,
|
457 |
+
'map_meta_cap' => $post_type['map_meta_cap'],
|
458 |
+
'hierarchical' => get_disp_boolean( $post_type['hierarchical'] ),
|
459 |
+
'rewrite' => $rewrite,
|
460 |
+
'menu_position' => $menu_position,
|
461 |
+
'menu_icon' => $menu_icon,
|
462 |
+
'query_var' => $post_type['query_var'],
|
463 |
+
'supports' => $post_type['supports'],
|
464 |
+
'taxonomies' => $post_type['taxonomies'],
|
465 |
+
);
|
466 |
+
|
467 |
+
if ( true === $yarpp ) {
|
468 |
+
$args['yarpp_support'] = $yarpp;
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* Filters the arguments used for a post type right before registering.
|
473 |
+
*
|
474 |
+
* @since 1.0.0
|
475 |
+
* @since 1.3.0 Added original passed in values array
|
476 |
+
*
|
477 |
+
* @param array $args Array of arguments to use for registering post type.
|
478 |
+
* @param string $value Post type slug to be registered.
|
479 |
+
* @param array $post_type Original passed in values for post type.
|
480 |
+
*/
|
481 |
+
$args = apply_filters( 'cptui_pre_register_post_type', $args, $post_type['name'], $post_type );
|
482 |
+
|
483 |
+
return register_post_type( $post_type['name'], $args );
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Register our users' custom taxonomies.
|
488 |
+
*
|
489 |
+
* @since 0.5.0
|
490 |
+
*
|
491 |
+
* @internal
|
492 |
+
*/
|
493 |
+
function cptui_create_custom_taxonomies() {
|
494 |
+
$taxes = get_option( 'cptui_taxonomies' );
|
495 |
+
|
496 |
+
if ( empty( $taxes ) ) {
|
497 |
+
return;
|
498 |
+
}
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Fires before the start of the taxonomy registrations.
|
502 |
+
*
|
503 |
+
* @since 1.3.0
|
504 |
+
*
|
505 |
+
* @param array $taxes Array of taxonomies to register.
|
506 |
+
*/
|
507 |
+
do_action( 'cptui_pre_register_taxonomies', $taxes );
|
508 |
+
|
509 |
+
if ( is_array( $taxes ) ) {
|
510 |
+
foreach ( $taxes as $tax ) {
|
511 |
+
cptui_register_single_taxonomy( $tax );
|
512 |
+
}
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* Fires after the completion of the taxonomy registrations.
|
517 |
+
*
|
518 |
+
* @since 1.3.0
|
519 |
+
*
|
520 |
+
* @param array $taxes Array of taxonomies registered.
|
521 |
+
*/
|
522 |
+
do_action( 'cptui_post_register_taxonomies', $taxes );
|
523 |
+
}
|
524 |
+
add_action( 'init', 'cptui_create_custom_taxonomies', 9 ); // Leave on standard init for legacy purposes.
|
525 |
+
|
526 |
+
/**
|
527 |
+
* Helper function to register the actual taxonomy.
|
528 |
+
*
|
529 |
+
* @since 1.0.0
|
530 |
+
*
|
531 |
+
* @internal
|
532 |
+
*
|
533 |
+
* @param array $taxonomy Taxonomy array to register. Optional.
|
534 |
+
* @return null Result of register_taxonomy.
|
535 |
+
*/
|
536 |
+
function cptui_register_single_taxonomy( $taxonomy = array() ) {
|
537 |
+
|
538 |
+
$labels = array(
|
539 |
+
'name' => $taxonomy['label'],
|
540 |
+
'singular_name' => $taxonomy['singular_label'],
|
541 |
+
);
|
542 |
+
|
543 |
+
$description = '';
|
544 |
+
if ( ! empty( $taxonomy['description'] ) ) {
|
545 |
+
$description = $taxonomy['description'];
|
546 |
+
}
|
547 |
+
|
548 |
+
$preserved = cptui_get_preserved_keys( 'taxonomies' );
|
549 |
+
$preserved_labels = cptui_get_preserved_labels();
|
550 |
+
foreach ( $taxonomy['labels'] as $key => $label ) {
|
551 |
+
|
552 |
+
if ( ! empty( $label ) ) {
|
553 |
+
$labels[ $key ] = $label;
|
554 |
+
} elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
|
555 |
+
$singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['taxonomies']['plural'] ) ) ) ? 'plural' : 'singular';
|
556 |
+
$label_plurality = ( 'plural' === $singular_or_plural ) ? $taxonomy['label'] : $taxonomy['singular_label'];
|
557 |
+
$labels[ $key ] = sprintf( $preserved_labels['taxonomies'][ $singular_or_plural ][ $key ], $label_plurality );
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
$rewrite = get_disp_boolean( $taxonomy['rewrite'] );
|
562 |
+
if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
|
563 |
+
$rewrite = array();
|
564 |
+
$rewrite['slug'] = ( ! empty( $taxonomy['rewrite_slug'] ) ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
|
565 |
+
$rewrite['with_front'] = true;
|
566 |
+
if ( isset( $taxonomy['rewrite_withfront'] ) ) {
|
567 |
+
$rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
|
568 |
+
}
|
569 |
+
$rewrite['hierarchical'] = false;
|
570 |
+
if ( isset( $taxonomy['rewrite_hierarchical'] ) ) {
|
571 |
+
$rewrite['hierarchical'] = ( 'true' === disp_boolean( $taxonomy['rewrite_hierarchical'] ) ) ? true : false;
|
572 |
+
}
|
573 |
+
}
|
574 |
+
|
575 |
+
if ( in_array( $taxonomy['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
|
576 |
+
$taxonomy['query_var'] = get_disp_boolean( $taxonomy['query_var'] );
|
577 |
+
}
|
578 |
+
if ( true === $taxonomy['query_var'] && ! empty( $taxonomy['query_var_slug'] ) ) {
|
579 |
+
$taxonomy['query_var'] = $taxonomy['query_var_slug'];
|
580 |
+
}
|
581 |
+
|
582 |
+
$public = ( ! empty( $taxonomy['public'] ) && false === get_disp_boolean( $taxonomy['public'] ) ) ? false : true;
|
583 |
+
$publicly_queryable = ( ! empty( $taxonomy['publicly_queryable'] ) && false === get_disp_boolean( $taxonomy['publicly_queryable'] ) ) ? false : true;
|
584 |
+
if ( empty( $taxonomy['publicly_queryable'] ) ) {
|
585 |
+
$publicly_queryable = $public;
|
586 |
+
}
|
587 |
+
|
588 |
+
$show_admin_column = ( ! empty( $taxonomy['show_admin_column'] ) && false !== get_disp_boolean( $taxonomy['show_admin_column'] ) ) ? true : false;
|
589 |
+
|
590 |
+
$show_in_menu = ( ! empty( $taxonomy['show_in_menu'] ) && false !== get_disp_boolean( $taxonomy['show_in_menu'] ) ) ? true : false;
|
591 |
+
|
592 |
+
if ( empty( $taxonomy['show_in_menu'] ) ) {
|
593 |
+
$show_in_menu = get_disp_boolean( $taxonomy['show_ui'] );
|
594 |
+
}
|
595 |
+
|
596 |
+
$show_in_nav_menus = ( ! empty( $taxonomy['show_in_nav_menus'] ) && false !== get_disp_boolean( $taxonomy['show_in_nav_menus'] ) ) ? true : false;
|
597 |
+
if ( empty( $taxonomy['show_in_nav_menus'] ) ) {
|
598 |
+
$show_in_nav_menus = $public;
|
599 |
+
}
|
600 |
+
|
601 |
+
$show_in_rest = ( ! empty( $taxonomy['show_in_rest'] ) && false !== get_disp_boolean( $taxonomy['show_in_rest'] ) ) ? true : false;
|
602 |
+
|
603 |
+
$show_in_quick_edit = ( ! empty( $taxonomy['show_in_quick_edit'] ) && false !== get_disp_boolean( $taxonomy['show_in_quick_edit'] ) ) ? true : false;
|
604 |
+
|
605 |
+
$rest_base = null;
|
606 |
+
if ( ! empty( $taxonomy['rest_base'] ) ) {
|
607 |
+
$rest_base = $taxonomy['rest_base'];
|
608 |
+
}
|
609 |
+
|
610 |
+
$rest_controller_class = null;
|
611 |
+
if ( ! empty( $post_type['rest_controller_class'] ) ) {
|
612 |
+
$rest_controller_class = $post_type['rest_controller_class'];
|
613 |
+
}
|
614 |
+
|
615 |
+
$meta_box_cb = null;
|
616 |
+
if ( ! empty( $taxonomy['meta_box_cb'] ) ) {
|
617 |
+
$meta_box_cb = ( false !== get_disp_boolean( $taxonomy['meta_box_cb'] ) ) ? $taxonomy['meta_box_cb'] : false;
|
618 |
+
}
|
619 |
+
|
620 |
+
$args = array(
|
621 |
+
'labels' => $labels,
|
622 |
+
'label' => $taxonomy['label'],
|
623 |
+
'description' => $description,
|
624 |
+
'public' => $public,
|
625 |
+
'publicly_queryable' => $publicly_queryable,
|
626 |
+
'hierarchical' => get_disp_boolean( $taxonomy['hierarchical'] ),
|
627 |
+
'show_ui' => get_disp_boolean( $taxonomy['show_ui'] ),
|
628 |
+
'show_in_menu' => $show_in_menu,
|
629 |
+
'show_in_nav_menus' => $show_in_nav_menus,
|
630 |
+
'query_var' => $taxonomy['query_var'],
|
631 |
+
'rewrite' => $rewrite,
|
632 |
+
'show_admin_column' => $show_admin_column,
|
633 |
+
'show_in_rest' => $show_in_rest,
|
634 |
+
'rest_base' => $rest_base,
|
635 |
+
'rest_controller_class' => $rest_controller_class,
|
636 |
+
'show_in_quick_edit' => $show_in_quick_edit,
|
637 |
+
'meta_box_cb' => $meta_box_cb,
|
638 |
+
);
|
639 |
+
|
640 |
+
$object_type = ( ! empty( $taxonomy['object_types'] ) ) ? $taxonomy['object_types'] : '';
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Filters the arguments used for a taxonomy right before registering.
|
644 |
+
*
|
645 |
+
* @since 1.0.0
|
646 |
+
* @since 1.3.0 Added original passed in values array
|
647 |
+
* @since 1.6.0 Added $obect_type variable to passed parameters.
|
648 |
+
*
|
649 |
+
* @param array $args Array of arguments to use for registering taxonomy.
|
650 |
+
* @param string $value Taxonomy slug to be registered.
|
651 |
+
* @param array $taxonomy Original passed in values for taxonomy.
|
652 |
+
* @param array $object_type Array of chosen post types for the taxonomy.
|
653 |
+
*/
|
654 |
+
$args = apply_filters( 'cptui_pre_register_taxonomy', $args, $taxonomy['name'], $taxonomy, $object_type );
|
655 |
+
|
656 |
+
return register_taxonomy( $taxonomy['name'], $object_type, $args );
|
657 |
+
}
|
658 |
+
|
659 |
+
/**
|
660 |
+
* Construct and output tab navigation.
|
661 |
+
*
|
662 |
+
* @since 1.0.0
|
663 |
+
*
|
664 |
+
* @param string $page Whether it's the CPT or Taxonomy page. Optional. Default "post_types".
|
665 |
+
*/
|
666 |
+
function cptui_settings_tab_menu( $page = 'post_types' ) {
|
667 |
+
|
668 |
+
/**
|
669 |
+
* Filters the tabs to render on a given page.
|
670 |
+
*
|
671 |
+
* @since 1.3.0
|
672 |
+
*
|
673 |
+
* @param array $value Array of tabs to render.
|
674 |
+
* @param string $page Current page being displayed.
|
675 |
+
*/
|
676 |
+
$tabs = (array) apply_filters( 'cptui_get_tabs', array(), $page );
|
677 |
+
|
678 |
+
if ( ! empty( $tabs['page_title'] ) ) {
|
679 |
+
printf(
|
680 |
+
'<h1>%s</h1><h2 class="nav-tab-wrapper">',
|
681 |
+
$tabs['page_title']
|
682 |
+
);
|
683 |
+
}
|
684 |
+
|
685 |
+
foreach ( $tabs['tabs'] as $tab ) {
|
686 |
+
printf(
|
687 |
+
'<a class="%s" href="%s" aria-selected="%s">%s</a>',
|
688 |
+
implode( ' ', $tab['classes'] ),
|
689 |
+
$tab['url'],
|
690 |
+
$tab['aria-selected'],
|
691 |
+
$tab['text']
|
692 |
+
);
|
693 |
+
}
|
694 |
+
|
695 |
+
echo '</h2>';
|
696 |
+
}
|
697 |
+
|
698 |
+
/**
|
699 |
+
* Convert our old settings to the new options keys.
|
700 |
+
*
|
701 |
+
* These are left with standard get_option/update_option function calls for legacy and pending update purposes.
|
702 |
+
*
|
703 |
+
* @since 1.0.0
|
704 |
+
*
|
705 |
+
* @internal
|
706 |
+
*
|
707 |
+
* @return bool Whether or not options were successfully updated.
|
708 |
+
*/
|
709 |
+
function cptui_convert_settings() {
|
710 |
+
|
711 |
+
if ( wp_doing_ajax() ) {
|
712 |
+
return;
|
713 |
+
}
|
714 |
+
|
715 |
+
$retval = '';
|
716 |
+
|
717 |
+
if ( false === get_option( 'cptui_post_types' ) && ( $post_types = get_option( 'cpt_custom_post_types' ) ) ) {
|
718 |
+
|
719 |
+
$new_post_types = array();
|
720 |
+
foreach ( $post_types as $type ) {
|
721 |
+
$new_post_types[ $type['name'] ] = $type; // This one assigns the # indexes. Named arrays are our friend.
|
722 |
+
$new_post_types[ $type['name'] ]['supports'] = ( ! empty( $type[0] ) ) ? $type[0] : array(); // Especially for multidimensional arrays.
|
723 |
+
$new_post_types[ $type['name'] ]['taxonomies'] = ( ! empty( $type[1] ) ) ? $type[1] : array();
|
724 |
+
$new_post_types[ $type['name'] ]['labels'] = ( ! empty( $type[2] ) ) ? $type[2] : array();
|
725 |
+
unset(
|
726 |
+
$new_post_types[ $type['name'] ][0],
|
727 |
+
$new_post_types[ $type['name'] ][1],
|
728 |
+
$new_post_types[ $type['name'] ][2]
|
729 |
+
); // Remove our previous indexed versions.
|
730 |
+
}
|
731 |
+
|
732 |
+
$retval = update_option( 'cptui_post_types', $new_post_types );
|
733 |
+
}
|
734 |
+
|
735 |
+
if ( false === get_option( 'cptui_taxonomies' ) && ( $taxonomies = get_option( 'cpt_custom_tax_types' ) ) ) {
|
736 |
+
|
737 |
+
$new_taxonomies = array();
|
738 |
+
foreach ( $taxonomies as $tax ) {
|
739 |
+
$new_taxonomies[ $tax['name'] ] = $tax; // Yep, still our friend.
|
740 |
+
$new_taxonomies[ $tax['name'] ]['labels'] = $tax[0]; // Taxonomies are the only thing with
|
741 |
+
$new_taxonomies[ $tax['name'] ]['object_types'] = $tax[1]; // "tax" in the name that I like.
|
742 |
+
unset(
|
743 |
+
$new_taxonomies[ $tax['name'] ][0],
|
744 |
+
$new_taxonomies[ $tax['name'] ][1]
|
745 |
+
);
|
746 |
+
}
|
747 |
+
|
748 |
+
$retval = update_option( 'cptui_taxonomies', $new_taxonomies );
|
749 |
+
}
|
750 |
+
|
751 |
+
if ( ! empty( $retval ) ) {
|
752 |
+
flush_rewrite_rules();
|
753 |
+
}
|
754 |
+
|
755 |
+
return $retval;
|
756 |
+
}
|
757 |
+
add_action( 'admin_init', 'cptui_convert_settings' );
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Return a notice based on conditions.
|
761 |
+
*
|
762 |
+
* @since 1.0.0
|
763 |
+
*
|
764 |
+
* @param string $action The type of action that occurred. Optional. Default empty string.
|
765 |
+
* @param string $object_type Whether it's from a post type or taxonomy. Optional. Default empty string.
|
766 |
+
* @param bool $success Whether the action succeeded or not. Optional. Default true.
|
767 |
+
* @param string $custom Custom message if necessary. Optional. Default empty string.
|
768 |
+
* @return bool|string false on no message, else HTML div with our notice message.
|
769 |
+
*/
|
770 |
+
function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
|
771 |
+
|
772 |
+
$class = array();
|
773 |
+
$class[] = ( $success ) ? 'updated' : 'error';
|
774 |
+
$class[] = 'notice is-dismissible';
|
775 |
+
$object_type = esc_attr( $object_type );
|
776 |
+
|
777 |
+
$messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>';
|
778 |
+
$message = '';
|
779 |
+
|
780 |
+
$messagewrapend = '</p></div>';
|
781 |
+
|
782 |
+
if ( 'add' == $action ) {
|
783 |
+
if ( $success ) {
|
784 |
+
$message .= sprintf( __( '%s has been successfully added', 'custom-post-type-ui' ), $object_type );
|
785 |
+
} else {
|
786 |
+
$message .= sprintf( __( '%s has failed to be added', 'custom-post-type-ui' ), $object_type );
|
787 |
+
}
|
788 |
+
} elseif ( 'update' == $action ) {
|
789 |
+
if ( $success ) {
|
790 |
+
$message .= sprintf( __( '%s has been successfully updated', 'custom-post-type-ui' ), $object_type );
|
791 |
+
} else {
|
792 |
+
$message .= sprintf( __( '%s has failed to be updated', 'custom-post-type-ui' ), $object_type );
|
793 |
+
}
|
794 |
+
} elseif ( 'delete' == $action ) {
|
795 |
+
if ( $success ) {
|
796 |
+
$message .= sprintf( __( '%s has been successfully deleted', 'custom-post-type-ui' ), $object_type );
|
797 |
+
} else {
|
798 |
+
$message .= sprintf( __( '%s has failed to be deleted', 'custom-post-type-ui' ), $object_type );
|
799 |
+
}
|
800 |
+
} elseif ( 'import' == $action ) {
|
801 |
+
if ( $success ) {
|
802 |
+
$message .= sprintf( __( '%s has been successfully imported', 'custom-post-type-ui' ), $object_type );
|
803 |
+
} else {
|
804 |
+
$message .= sprintf( __( '%s has failed to be imported', 'custom-post-type-ui' ), $object_type );
|
805 |
+
}
|
806 |
+
} elseif ( 'error' == $action ) {
|
807 |
+
if ( ! empty( $custom ) ) {
|
808 |
+
$message = $custom;
|
809 |
+
}
|
810 |
+
}
|
811 |
+
|
812 |
+
if ( $message ) {
|
813 |
+
|
814 |
+
/**
|
815 |
+
* Filters the custom admin notice for CPTUI.
|
816 |
+
*
|
817 |
+
* @since 1.0.0
|
818 |
+
*
|
819 |
+
* @param string $value Complete HTML output for notice.
|
820 |
+
* @param string $action Action whose message is being generated.
|
821 |
+
* @param string $message The message to be displayed.
|
822 |
+
* @param string $messagewrapstart Beginning wrap HTML.
|
823 |
+
* @param string $messagewrapend Ending wrap HTML.
|
824 |
+
*/
|
825 |
+
return apply_filters( 'cptui_admin_notice', $messagewrapstart . $message . $messagewrapend, $action, $message, $messagewrapstart, $messagewrapend );
|
826 |
+
}
|
827 |
+
|
828 |
+
return false;
|
829 |
+
}
|
830 |
+
|
831 |
+
/**
|
832 |
+
* Return array of keys needing preserved.
|
833 |
+
*
|
834 |
+
* @since 1.0.5
|
835 |
+
*
|
836 |
+
* @param string $type Type to return. Either 'post_types' or 'taxonomies'. Optional. Default empty string.
|
837 |
+
* @return array Array of keys needing preservered for the requested type.
|
838 |
+
*/
|
839 |
+
function cptui_get_preserved_keys( $type = '' ) {
|
840 |
+
|
841 |
+
$preserved_labels = array(
|
842 |
+
'post_types' => array(
|
843 |
+
'add_new_item',
|
844 |
+
'edit_item',
|
845 |
+
'new_item',
|
846 |
+
'view_item',
|
847 |
+
'all_items',
|
848 |
+
'search_items',
|
849 |
+
'not_found',
|
850 |
+
'not_found_in_trash',
|
851 |
+
),
|
852 |
+
'taxonomies' => array(
|
853 |
+
'search_items',
|
854 |
+
'popular_items',
|
855 |
+
'all_items',
|
856 |
+
'parent_item',
|
857 |
+
'parent_item_colon',
|
858 |
+
'edit_item',
|
859 |
+
'update_item',
|
860 |
+
'add_new_item',
|
861 |
+
'new_item_name',
|
862 |
+
'separate_items_with_commas',
|
863 |
+
'add_or_remove_items',
|
864 |
+
'choose_from_most_used',
|
865 |
+
),
|
866 |
+
);
|
867 |
+
return ( ! empty( $type ) ) ? $preserved_labels[ $type ] : array();
|
868 |
+
}
|
869 |
+
|
870 |
+
/**
|
871 |
+
* Return label for the requested type and label key.
|
872 |
+
*
|
873 |
+
* @since 1.0.5
|
874 |
+
*
|
875 |
+
* @deprecated
|
876 |
+
*
|
877 |
+
* @param string $type Type to return. Either 'post_types' or 'taxonomies'. Optional. Default empty string.
|
878 |
+
* @param string $key Requested label key. Optional. Default empty string.
|
879 |
+
* @param string $plural Plural verbiage for the requested label and type. Optional. Default empty string.
|
880 |
+
* @param string $singular Singular verbiage for the requested label and type. Optional. Default empty string.
|
881 |
+
* @return string Internationalized default label.
|
882 |
+
*/
|
883 |
+
function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singular = '' ) {
|
884 |
+
|
885 |
+
$preserved_labels = array(
|
886 |
+
'post_types' => array(
|
887 |
+
'add_new_item' => sprintf( __( 'Add new %s', 'custom-post-type-ui' ), $singular ),
|
888 |
+
'edit_item' => sprintf( __( 'Edit %s', 'custom-post-type-ui' ), $singular ),
|
889 |
+
'new_item' => sprintf( __( 'New %s', 'custom-post-type-ui' ), $singular ),
|
890 |
+
'view_item' => sprintf( __( 'View %s', 'custom-post-type-ui' ), $singular ),
|
891 |
+
'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
|
892 |
+
'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
|
893 |
+
'not_found' => sprintf( __( 'No %s found.', 'custom-post-type-ui' ), $plural ),
|
894 |
+
'not_found_in_trash' => sprintf( __( 'No %s found in trash.', 'custom-post-type-ui' ), $plural ),
|
895 |
+
),
|
896 |
+
'taxonomies' => array(
|
897 |
+
'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
|
898 |
+
'popular_items' => sprintf( __( 'Popular %s', 'custom-post-type-ui' ), $plural ),
|
899 |
+
'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
|
900 |
+
'parent_item' => sprintf( __( 'Parent %s', 'custom-post-type-ui' ), $singular ),
|
901 |
+
'parent_item_colon' => sprintf( __( 'Parent %s:', 'custom-post-type-ui' ), $singular ),
|
902 |
+
'edit_item' => sprintf( __( 'Edit %s', 'custom-post-type-ui' ), $singular ),
|
903 |
+
'update_item' => sprintf( __( 'Update %s', 'custom-post-type-ui' ), $singular ),
|
904 |
+
'add_new_item' => sprintf( __( 'Add new %s', 'custom-post-type-ui' ), $singular ),
|
905 |
+
'new_item_name' => sprintf( __( 'New %s name', 'custom-post-type-ui' ), $singular ),
|
906 |
+
'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'custom-post-type-ui' ), $plural ),
|
907 |
+
'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'custom-post-type-ui' ), $plural ),
|
908 |
+
'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'custom-post-type-ui' ), $plural ),
|
909 |
+
),
|
910 |
+
);
|
911 |
+
|
912 |
+
return $preserved_labels[ $type ][ $key ];
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* Returns an array of translated labels, ready for use with sprintf().
|
917 |
+
*
|
918 |
+
* Replacement for cptui_get_preserved_label for the sake of performance.
|
919 |
+
*
|
920 |
+
* @since 1.6.0
|
921 |
+
*
|
922 |
+
* @return array
|
923 |
+
*/
|
924 |
+
function cptui_get_preserved_labels() {
|
925 |
+
return array(
|
926 |
+
'post_types' => array(
|
927 |
+
'singular' => array(
|
928 |
+
'add_new_item' => __( 'Add new %s', 'custom-post-type-ui' ),
|
929 |
+
'edit_item' => __( 'Edit %s', 'custom-post-type-ui' ),
|
930 |
+
'new_item' => __( 'New %s', 'custom-post-type-ui' ),
|
931 |
+
'view_item' => __( 'View %s', 'custom-post-type-ui' ),
|
932 |
+
),
|
933 |
+
'plural' => array(
|
934 |
+
'all_items' => __( 'All %s', 'custom-post-type-ui' ),
|
935 |
+
'search_items' => __( 'Search %s', 'custom-post-type-ui' ),
|
936 |
+
'not_found' => __( 'No %s found.', 'custom-post-type-ui' ),
|
937 |
+
'not_found_in_trash' => __( 'No %s found in trash.', 'custom-post-type-ui' ),
|
938 |
+
),
|
939 |
+
),
|
940 |
+
'taxonomies' => array(
|
941 |
+
'singular' => array(
|
942 |
+
'parent_item' => __( 'Parent %s', 'custom-post-type-ui' ),
|
943 |
+
'parent_item_colon' => __( 'Parent %s:', 'custom-post-type-ui' ),
|
944 |
+
'edit_item' => __( 'Edit %s', 'custom-post-type-ui' ),
|
945 |
+
'update_item' => __( 'Update %s', 'custom-post-type-ui' ),
|
946 |
+
'add_new_item' => __( 'Add new %s', 'custom-post-type-ui' ),
|
947 |
+
'new_item_name' => __( 'New %s name', 'custom-post-type-ui' ),
|
948 |
+
),
|
949 |
+
'plural' => array(
|
950 |
+
'search_items' => __( 'Search %s', 'custom-post-type-ui' ),
|
951 |
+
'popular_items' => __( 'Popular %s', 'custom-post-type-ui' ),
|
952 |
+
'all_items' => __( 'All %s', 'custom-post-type-ui' ),
|
953 |
+
'separate_items_with_commas' => __( 'Separate %s with commas', 'custom-post-type-ui' ),
|
954 |
+
'add_or_remove_items' => __( 'Add or remove %s', 'custom-post-type-ui' ),
|
955 |
+
'choose_from_most_used' => __( 'Choose from the most used %s', 'custom-post-type-ui' ),
|
956 |
+
)
|
957 |
+
),
|
958 |
+
);
|
959 |
+
}
|
images/wds_ads/cptui-extended.png
CHANGED
Binary file
|
inc/about.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage About
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.3.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -13,6 +14,26 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
exit;
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Display our primary menu page.
|
18 |
*
|
@@ -31,7 +52,7 @@ function cptui_settings() {
|
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
do_action( 'cptui_main_page_start' ); ?>
|
34 |
-
<h1><?php esc_html_e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo CPTUI_VERSION; ?></h1>
|
35 |
|
36 |
<?php
|
37 |
|
@@ -60,16 +81,16 @@ function cptui_settings() {
|
|
60 |
<div class="changelog about-integrations">
|
61 |
<div class="cptui-feature feature-section col three-col">
|
62 |
<div class="col">
|
63 |
-
<h2><?php esc_html_e( '
|
64 |
-
<p><?php esc_html_e( '
|
65 |
</div>
|
66 |
<div class="col">
|
67 |
-
<h2><?php esc_html_e( '
|
68 |
-
<p><?php esc_html_e( '
|
69 |
</div>
|
70 |
<div class="col last-feature">
|
71 |
-
<h2><?php esc_html_e( '
|
72 |
-
<p><?php esc_html_e( '
|
73 |
</div>
|
74 |
</div>
|
75 |
</div>
|
@@ -133,58 +154,12 @@ function cptui_about_page_newsletter() {
|
|
133 |
?>
|
134 |
<h3><?php esc_html_e( 'Stay informed', 'custom-post-type-ui' ); ?></h3>
|
135 |
<?php
|
136 |
-
|
137 |
|
138 |
return '';
|
139 |
}
|
140 |
add_action( 'cptui_main_page_before_changelog', 'cptui_about_page_newsletter' );
|
141 |
|
142 |
-
/**
|
143 |
-
* Outputs our newsletter signup form.
|
144 |
-
*
|
145 |
-
* @since 1.4.0
|
146 |
-
*
|
147 |
-
* @internal
|
148 |
-
*/
|
149 |
-
function cptui_about_page_newsletter_form() {
|
150 |
-
?>
|
151 |
-
<!-- Begin MailChimp Signup Form -->
|
152 |
-
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
|
153 |
-
<div id="mc_embed_signup">
|
154 |
-
<form action="//webdevstudios.us1.list-manage.com/subscribe/post?u=67169b098c99de702c897d63e&id=9cb1c7472e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
|
155 |
-
<div id="mc_embed_signup_scroll">
|
156 |
-
|
157 |
-
<p>
|
158 |
-
<strong><?php esc_html_e( 'Wanna make the most of WordPress? Sign up for the Pluginize newsletter and get access to discounts, plugin announcements, and more!', 'custom-post-type-ui' ); ?></strong>
|
159 |
-
</p>
|
160 |
-
<div class="mc-field-group">
|
161 |
-
<label for="mce-EMAIL"><?php esc_html_e( 'Email Address', 'custom-post-type-ui' ); ?></label>
|
162 |
-
<input tabindex="-1" type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
|
163 |
-
</div>
|
164 |
-
<div id="mce-responses" class="clear">
|
165 |
-
<div class="response" id="mce-error-response" style="display:none"></div>
|
166 |
-
<div class="response" id="mce-success-response" style="display:none"></div>
|
167 |
-
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
|
168 |
-
<div style="position: absolute; left: -5000px;" aria-hidden="true">
|
169 |
-
<input type="text" name="b_67169b098c99de702c897d63e_9cb1c7472e" tabindex="-1" value=""></div>
|
170 |
-
<div class="clear">
|
171 |
-
<input type="submit" value="<?php esc_attr_e( 'Subscribe', 'custom-post-type-ui' ); ?>" name="subscribe" id="mc-embedded-subscribe" class="button" tabindex="-1">
|
172 |
-
</div>
|
173 |
-
</div>
|
174 |
-
</form>
|
175 |
-
</div>
|
176 |
-
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script>
|
177 |
-
<script type='text/javascript'>(function ($) {
|
178 |
-
window.fnames = new Array();
|
179 |
-
window.ftypes = new Array();
|
180 |
-
fnames[0] = 'EMAIL';
|
181 |
-
ftypes[0] = 'email';
|
182 |
-
}(jQuery));
|
183 |
-
var $mcj = jQuery.noConflict(true);</script>
|
184 |
-
<!--End mc_embed_signup-->
|
185 |
-
<?php
|
186 |
-
}
|
187 |
-
|
188 |
/**
|
189 |
* Marks site as not new at the end of the about/main page.
|
190 |
*
|
6 |
* @subpackage About
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.3.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
+
/**
|
18 |
+
* Enqueue our Custom Post Type UI assets.
|
19 |
+
*
|
20 |
+
* @since 1.6.0
|
21 |
+
*/
|
22 |
+
function cptui_about_assets() {
|
23 |
+
$current_screen = get_current_screen();
|
24 |
+
|
25 |
+
if ( ! is_object( $current_screen ) || 'toplevel_page_cptui_main_menu' !== $current_screen->base ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( wp_doing_ajax() ) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
wp_enqueue_style( 'cptui-css' );
|
34 |
+
}
|
35 |
+
add_action( 'admin_enqueue_scripts', 'cptui_about_assets' );
|
36 |
+
|
37 |
/**
|
38 |
* Display our primary menu page.
|
39 |
*
|
52 |
* @since 1.0.0
|
53 |
*/
|
54 |
do_action( 'cptui_main_page_start' ); ?>
|
55 |
+
<h1><?php esc_html_e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo esc_html( CPTUI_VERSION ); ?></h1>
|
56 |
|
57 |
<?php
|
58 |
|
81 |
<div class="changelog about-integrations">
|
82 |
<div class="cptui-feature feature-section col three-col">
|
83 |
<div class="col">
|
84 |
+
<h2><?php esc_html_e( 'Taxonomy support for meta_box_cb parameter', 'custom-post-type-ui' ); ?></h2>
|
85 |
+
<p><?php esc_html_e( 'We have added a field to provide a function callback to use for the metabox for your taxonomies. This allows you to customize and provide your own metabox output instead of using the default.', 'custom-post-type-ui' ); ?></p>
|
86 |
</div>
|
87 |
<div class="col">
|
88 |
+
<h2><?php esc_html_e( 'WP-CLI Support', 'custom-post-type-ui' ); ?></h2>
|
89 |
+
<p><?php esc_html_e( 'We have added some initial WP-CLI support around importing and exporting your Custom Post Type UI settings. This will help with setting up your websites and provide some possible automation tools.', 'custom-post-type-ui' ); ?></p>
|
90 |
</div>
|
91 |
<div class="col last-feature">
|
92 |
+
<h2><?php esc_html_e( 'Adjusted default "Show in REST" paramter.', 'custom-post-type-ui' ); ?></h2>
|
93 |
+
<p><?php esc_html_e( 'Gutenberg is coming with WordPress 5.0. For post types to have "Gutenberg" support, the "Show in REST" parameter needs to be set to true. We are changing this to help ease users into better integration.', 'custom-post-type-ui' ) ?></p>
|
94 |
</div>
|
95 |
</div>
|
96 |
</div>
|
154 |
?>
|
155 |
<h3><?php esc_html_e( 'Stay informed', 'custom-post-type-ui' ); ?></h3>
|
156 |
<?php
|
157 |
+
cptui_newsletter_form();
|
158 |
|
159 |
return '';
|
160 |
}
|
161 |
add_action( 'cptui_main_page_before_changelog', 'cptui_about_page_newsletter' );
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
/**
|
164 |
* Marks site as not new at the end of the about/main page.
|
165 |
*
|
inc/listings.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage Listings
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.1.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -13,6 +14,26 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
exit;
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Output the content for the "Registered Types/Taxes" page.
|
18 |
*
|
@@ -38,7 +59,14 @@ function cptui_listings() {
|
|
38 |
echo '<h2 id="post-types">' . esc_html__( 'Post Types', 'custom-post-type-ui' ) . '</h2>';
|
39 |
if ( ! empty( $post_types ) ) {
|
40 |
?>
|
41 |
-
<p><?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
<?php
|
44 |
|
@@ -113,6 +141,7 @@ function cptui_listings() {
|
|
113 |
<a href="%s">%s</a><br/>',
|
114 |
esc_attr( $post_type_link_url ),
|
115 |
sprintf(
|
|
|
116 |
esc_html__( 'Edit %s', 'custom-post-type-ui' ),
|
117 |
esc_html( $post_type )
|
118 |
),
|
@@ -129,7 +158,7 @@ function cptui_listings() {
|
|
129 |
<?php
|
130 |
foreach ( $strings as $key => $value ) {
|
131 |
printf( '<strong>%s:</strong> ', esc_html( $key ) );
|
132 |
-
if ( in_array( $value, array( '1', '0' ) ) ) {
|
133 |
echo esc_html( disp_boolean( $value ) );
|
134 |
} else {
|
135 |
echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
|
@@ -187,10 +216,10 @@ function cptui_listings() {
|
|
187 |
</p>
|
188 |
|
189 |
<p><strong><?php esc_html_e( 'Single Posts file name examples.', 'custom-post-type-ui' ); ?></strong><br/>
|
190 |
-
single-<?php echo esc_html( $post_type ); ?>-post_slug.php
|
191 |
single-<?php echo esc_html( $post_type ); ?>.php<br/>
|
192 |
single.php<br/>
|
193 |
-
singular.php
|
194 |
index.php
|
195 |
</p>
|
196 |
|
@@ -242,7 +271,15 @@ function cptui_listings() {
|
|
242 |
echo '<h2 id="taxonomies">' . esc_html__( 'Taxonomies', 'custom-post-type-ui' ) . '</h2>';
|
243 |
if ( ! empty( $taxonomies ) ) {
|
244 |
?>
|
245 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
<?php
|
248 |
|
@@ -309,6 +346,7 @@ function cptui_listings() {
|
|
309 |
<a href="%s">%s</a>',
|
310 |
esc_attr( $taxonomy_link_url ),
|
311 |
sprintf(
|
|
|
312 |
esc_html__( 'Edit %s', 'custom-post-type-ui' ),
|
313 |
esc_html( $taxonomy )
|
314 |
),
|
@@ -320,7 +358,7 @@ function cptui_listings() {
|
|
320 |
<?php
|
321 |
foreach ( $strings as $key => $value ) {
|
322 |
printf( '<strong>%s:</strong> ', esc_html( $key ) );
|
323 |
-
if ( in_array( $value, array( '1', '0' ) ) ) {
|
324 |
echo esc_html( disp_boolean( $value ) );
|
325 |
} else {
|
326 |
echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
|
@@ -422,7 +460,9 @@ function cptui_listings() {
|
|
422 |
* @internal
|
423 |
*/
|
424 |
function cptui_no_post_types_to_list() {
|
425 |
-
echo '<p>' . sprintf(
|
|
|
|
|
426 |
sprintf( '<a href="%s">%s</a>',
|
427 |
esc_attr( admin_url( 'admin.php?page=cptui_manage_post_types' ) ),
|
428 |
esc_html__( 'Add/Edit Post Types', 'custom-post-type-ui' )
|
@@ -441,7 +481,9 @@ add_action( 'cptui_no_post_types_listing', 'cptui_no_post_types_to_list' );
|
|
441 |
* @internal
|
442 |
*/
|
443 |
function cptui_no_taxonomies_to_list() {
|
444 |
-
echo '<p>' . sprintf(
|
|
|
|
|
445 |
sprintf( '<a href="%s">%s</a>',
|
446 |
esc_attr( admin_url( 'admin.php?page=cptui_manage_taxonomies' ) ),
|
447 |
esc_html__( 'Add/Edit Taxonomies', 'custom-post-type-ui' )
|
6 |
* @subpackage Listings
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.1.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
+
/**
|
18 |
+
* Enqueue our Custom Post Type UI assets.
|
19 |
+
*
|
20 |
+
* @since 1.6.0
|
21 |
+
*/
|
22 |
+
function cptui_listings_assets() {
|
23 |
+
$current_screen = get_current_screen();
|
24 |
+
|
25 |
+
if ( ! is_object( $current_screen ) || 'cpt-ui_page_cptui_listings' !== $current_screen->base ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( wp_doing_ajax() ) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
wp_enqueue_style( 'cptui-css' );
|
34 |
+
}
|
35 |
+
add_action( 'admin_enqueue_scripts', 'cptui_listings_assets' );
|
36 |
+
|
37 |
/**
|
38 |
* Output the content for the "Registered Types/Taxes" page.
|
39 |
*
|
59 |
echo '<h2 id="post-types">' . esc_html__( 'Post Types', 'custom-post-type-ui' ) . '</h2>';
|
60 |
if ( ! empty( $post_types ) ) {
|
61 |
?>
|
62 |
+
<p><?php
|
63 |
+
printf(
|
64 |
+
/* translators: %s: Total count of registered CPTUI post types */
|
65 |
+
esc_html__( 'Custom Post Type UI registered post types count total: %d', 'custom-post-type-ui' ),
|
66 |
+
count( $post_types )
|
67 |
+
);
|
68 |
+
?>
|
69 |
+
</p>
|
70 |
|
71 |
<?php
|
72 |
|
141 |
<a href="%s">%s</a><br/>',
|
142 |
esc_attr( $post_type_link_url ),
|
143 |
sprintf(
|
144 |
+
/* translators: %s: Post type slug */
|
145 |
esc_html__( 'Edit %s', 'custom-post-type-ui' ),
|
146 |
esc_html( $post_type )
|
147 |
),
|
158 |
<?php
|
159 |
foreach ( $strings as $key => $value ) {
|
160 |
printf( '<strong>%s:</strong> ', esc_html( $key ) );
|
161 |
+
if ( in_array( $value, array( '1', '0' ), true ) ) {
|
162 |
echo esc_html( disp_boolean( $value ) );
|
163 |
} else {
|
164 |
echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
|
216 |
</p>
|
217 |
|
218 |
<p><strong><?php esc_html_e( 'Single Posts file name examples.', 'custom-post-type-ui' ); ?></strong><br/>
|
219 |
+
single-<?php echo esc_html( $post_type ); ?>-post_slug.php *<br/>
|
220 |
single-<?php echo esc_html( $post_type ); ?>.php<br/>
|
221 |
single.php<br/>
|
222 |
+
singular.php<br/>
|
223 |
index.php
|
224 |
</p>
|
225 |
|
271 |
echo '<h2 id="taxonomies">' . esc_html__( 'Taxonomies', 'custom-post-type-ui' ) . '</h2>';
|
272 |
if ( ! empty( $taxonomies ) ) {
|
273 |
?>
|
274 |
+
<p>
|
275 |
+
<?php
|
276 |
+
printf(
|
277 |
+
/* translators: %s: Total count of CPTUI registered taxonomies */
|
278 |
+
esc_html__( 'Custom Post Type UI registered taxonomies count total: %d', 'custom-post-type-ui' ),
|
279 |
+
count( $taxonomies )
|
280 |
+
);
|
281 |
+
?>
|
282 |
+
</p>
|
283 |
|
284 |
<?php
|
285 |
|
346 |
<a href="%s">%s</a>',
|
347 |
esc_attr( $taxonomy_link_url ),
|
348 |
sprintf(
|
349 |
+
/* translators: %s: Taxonomy slug */
|
350 |
esc_html__( 'Edit %s', 'custom-post-type-ui' ),
|
351 |
esc_html( $taxonomy )
|
352 |
),
|
358 |
<?php
|
359 |
foreach ( $strings as $key => $value ) {
|
360 |
printf( '<strong>%s:</strong> ', esc_html( $key ) );
|
361 |
+
if ( in_array( $value, array( '1', '0' ), true ) ) {
|
362 |
echo esc_html( disp_boolean( $value ) );
|
363 |
} else {
|
364 |
echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
|
460 |
* @internal
|
461 |
*/
|
462 |
function cptui_no_post_types_to_list() {
|
463 |
+
echo '<p>' . sprintf(
|
464 |
+
/* translators: 1st %s: Link to manage post types section 2nd %s Link text */
|
465 |
+
esc_html__( 'No post types registered for display. Visit %s to get started.', 'custom-post-type-ui' ),
|
466 |
sprintf( '<a href="%s">%s</a>',
|
467 |
esc_attr( admin_url( 'admin.php?page=cptui_manage_post_types' ) ),
|
468 |
esc_html__( 'Add/Edit Post Types', 'custom-post-type-ui' )
|
481 |
* @internal
|
482 |
*/
|
483 |
function cptui_no_taxonomies_to_list() {
|
484 |
+
echo '<p>' . sprintf(
|
485 |
+
/* translators: %s: Link to manage taxonomies section */
|
486 |
+
esc_html__( 'No taxonomies registered for display. Visit %s to get started.', 'custom-post-type-ui' ),
|
487 |
sprintf( '<a href="%s">%s</a>',
|
488 |
esc_attr( admin_url( 'admin.php?page=cptui_manage_taxonomies' ) ),
|
489 |
esc_html__( 'Add/Edit Taxonomies', 'custom-post-type-ui' )
|
inc/post-types.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage PostTypes
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -28,15 +29,23 @@ function cptui_post_type_enqueue_scripts() {
|
|
28 |
return;
|
29 |
}
|
30 |
|
31 |
-
if (
|
32 |
return;
|
33 |
}
|
34 |
|
35 |
wp_enqueue_media();
|
36 |
wp_enqueue_script( 'cptui' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
wp_localize_script( 'cptui', 'cptui_type_data',
|
38 |
array(
|
39 |
'confirm' => esc_html__( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'custom-post-type-ui' ),
|
|
|
40 |
)
|
41 |
);
|
42 |
}
|
@@ -55,7 +64,7 @@ add_action( 'admin_enqueue_scripts', 'cptui_post_type_enqueue_scripts' );
|
|
55 |
*/
|
56 |
function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
|
57 |
|
58 |
-
if ( 'post_types'
|
59 |
$post_types = cptui_get_post_type_data();
|
60 |
$classes = array( 'nav-tab' );
|
61 |
|
@@ -116,8 +125,10 @@ add_filter( 'cptui_get_tabs', 'cptui_post_type_tabs', 10, 2 );
|
|
116 |
*/
|
117 |
function cptui_manage_post_types() {
|
118 |
|
119 |
-
$tab
|
120 |
-
$tab_class = 'cptui-' . $tab;
|
|
|
|
|
121 |
|
122 |
<div class="wrap <?php echo esc_attr( $tab_class ); ?>">
|
123 |
|
@@ -147,7 +158,7 @@ function cptui_manage_post_types() {
|
|
147 |
*/
|
148 |
do_action( 'cptui_below_post_type_tab_menu' );
|
149 |
|
150 |
-
if ( 'edit'
|
151 |
|
152 |
$post_types = cptui_get_post_type_data();
|
153 |
|
@@ -169,6 +180,8 @@ function cptui_manage_post_types() {
|
|
169 |
<?php
|
170 |
cptui_post_types_dropdown( $post_types );
|
171 |
|
|
|
|
|
172 |
/**
|
173 |
* Filters the text value to use on the select post type button.
|
174 |
*
|
@@ -210,9 +223,10 @@ function cptui_manage_post_types() {
|
|
210 |
echo $ui->get_label( 'name', esc_html__( 'Post Type Slug', 'custom-post-type-ui' ) );
|
211 |
echo $ui->get_required_span();
|
212 |
|
213 |
-
if ( 'edit'
|
214 |
-
echo '<p id="slugchanged" class="hidemessage">' . esc_html__( 'Slug has changed', '
|
215 |
}
|
|
|
216 |
|
217 |
echo $ui->get_th_end() . $ui->get_td_start();
|
218 |
|
@@ -230,7 +244,7 @@ function cptui_manage_post_types() {
|
|
230 |
esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores should be used in place of spaces. Set "Custom Rewrite Slug" field to make slug use dashes for URLs.', 'custom-post-type-ui' );
|
231 |
echo '</p>';
|
232 |
|
233 |
-
if ( 'edit'
|
234 |
echo '<p>';
|
235 |
esc_html_e( 'DO NOT EDIT the post type slug unless also planning to migrate posts. Changing the slug registers a new post type entry.', 'custom-post-type-ui' );
|
236 |
echo '</p>';
|
@@ -274,7 +288,7 @@ function cptui_manage_post_types() {
|
|
274 |
</table>
|
275 |
<p class="submit">
|
276 |
<?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
|
277 |
-
if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit'
|
278 |
<?php
|
279 |
|
280 |
/**
|
@@ -312,11 +326,11 @@ function cptui_manage_post_types() {
|
|
312 |
<?php }
|
313 |
|
314 |
if ( ! empty( $current ) ) { ?>
|
315 |
-
<input type="hidden" name="cpt_original" id="cpt_original" value="<?php
|
316 |
<?php }
|
317 |
|
318 |
// Used to check and see if we should prevent duplicate slugs. ?>
|
319 |
-
<input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php
|
320 |
</p>
|
321 |
</div>
|
322 |
</div>
|
@@ -554,6 +568,16 @@ function cptui_manage_post_types() {
|
|
554 |
'textvalue' => ( isset( $current['labels']['attributes'] ) ) ? esc_attr( $current['labels']['attributes'] ) : '',
|
555 |
'aftertext' => esc_html__( '(e.g. Movies Attributes)', 'custom-post-type-ui' ),
|
556 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
?>
|
558 |
</table>
|
559 |
</div>
|
@@ -583,7 +607,7 @@ function cptui_manage_post_types() {
|
|
583 |
'namearray' => 'cpt_custom_post_type',
|
584 |
'name' => 'public',
|
585 |
'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),
|
586 |
-
'aftertext' => esc_html__( '(
|
587 |
'selections' => $select,
|
588 |
) );
|
589 |
|
@@ -631,14 +655,14 @@ function cptui_manage_post_types() {
|
|
631 |
'namearray' => 'cpt_custom_post_type',
|
632 |
'name' => 'show_in_nav_menus',
|
633 |
'labeltext' => esc_html__( 'Show in Nav Menus', 'custom-post-type-ui' ),
|
634 |
-
'aftertext' => esc_html__( '(
|
635 |
'selections' => $select,
|
636 |
) );
|
637 |
|
638 |
$select = array(
|
639 |
'options' => array(
|
640 |
-
array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' )
|
641 |
-
array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
|
642 |
),
|
643 |
);
|
644 |
$selected = ( isset( $current ) && ! empty( $current['show_in_rest'] ) ) ? disp_boolean( $current['show_in_rest'] ) : '';
|
@@ -647,7 +671,7 @@ function cptui_manage_post_types() {
|
|
647 |
'namearray' => 'cpt_custom_post_type',
|
648 |
'name' => 'show_in_rest',
|
649 |
'labeltext' => esc_html__( 'Show in REST API', 'custom-post-type-ui' ),
|
650 |
-
'aftertext' => esc_html__( '(default:
|
651 |
'selections' => $select,
|
652 |
) );
|
653 |
|
@@ -659,6 +683,14 @@ function cptui_manage_post_types() {
|
|
659 |
'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
|
660 |
) );
|
661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
echo $ui->get_tr_start() . $ui->get_th_start();
|
663 |
echo $ui->get_label( 'has_archive', esc_html__( 'Has Archive', 'custom-post-type-ui' ) );
|
664 |
echo $ui->get_p( esc_html__( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) );
|
@@ -713,7 +745,7 @@ function cptui_manage_post_types() {
|
|
713 |
'name' => 'capability_type',
|
714 |
'textvalue' => ( isset( $current['capability_type'] ) ) ? esc_attr( $current['capability_type'] ) : 'post',
|
715 |
'labeltext' => esc_html__( 'Capability Type', 'custom-post-type-ui' ),
|
716 |
-
'helptext' => esc_html__( 'The post type to use for checking read, edit, and delete capabilities.', 'custom-post-type-ui' ),
|
717 |
) );
|
718 |
|
719 |
$select = array(
|
@@ -769,7 +801,7 @@ function cptui_manage_post_types() {
|
|
769 |
'namearray' => 'cpt_custom_post_type',
|
770 |
'name' => 'rewrite_withfront',
|
771 |
'labeltext' => esc_html__( 'With Front', 'custom-post-type-ui' ),
|
772 |
-
'aftertext' => esc_html__( '(default: true) Should the
|
773 |
'selections' => $select,
|
774 |
) );
|
775 |
|
@@ -878,7 +910,7 @@ function cptui_manage_post_types() {
|
|
878 |
|
879 |
echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' );
|
880 |
|
881 |
-
echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right. A checked value means the post type means the feature is supported.', '
|
882 |
|
883 |
echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) );
|
884 |
|
@@ -1063,7 +1095,15 @@ function cptui_manage_post_types() {
|
|
1063 |
$args = array( 'public' => true );
|
1064 |
}
|
1065 |
|
1066 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1067 |
unset( $add_taxes['nav_menu'] ); unset( $add_taxes['post_format'] );
|
1068 |
foreach ( $add_taxes as $add_tax ) {
|
1069 |
|
@@ -1162,6 +1202,16 @@ function cptui_post_types_dropdown( $post_types = array() ) {
|
|
1162 |
$current = cptui_get_current_post_type();
|
1163 |
|
1164 |
$select['selected'] = $current;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1165 |
echo $ui->get_select_input( array(
|
1166 |
'namearray' => 'cptui_selected_post_type',
|
1167 |
'name' => 'post_type',
|
@@ -1186,6 +1236,9 @@ function cptui_get_current_post_type( $post_type_deleted = false ) {
|
|
1186 |
$type = false;
|
1187 |
|
1188 |
if ( ! empty( $_POST ) ) {
|
|
|
|
|
|
|
1189 |
if ( isset( $_POST['cptui_selected_post_type']['post_type'] ) ) {
|
1190 |
$type = sanitize_text_field( $_POST['cptui_selected_post_type']['post_type'] );
|
1191 |
} else if ( $post_type_deleted ) {
|
@@ -1359,7 +1412,6 @@ function cptui_update_post_type( $data = array() ) {
|
|
1359 |
add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_post_type' );
|
1360 |
return 'error';
|
1361 |
}
|
1362 |
-
|
1363 |
if ( 'new' == $data['cpt_type_status'] ) {
|
1364 |
$slug_as_page = cptui_check_page_slugs( $data['cpt_custom_post_type']['name'] );
|
1365 |
if ( true === $slug_as_page ) {
|
@@ -1407,49 +1459,61 @@ function cptui_update_post_type( $data = array() ) {
|
|
1407 |
$singular_label = htmlspecialchars( stripslashes( $singular_label ), ENT_QUOTES );
|
1408 |
}
|
1409 |
|
1410 |
-
$name
|
1411 |
-
$description
|
1412 |
-
$rest_base
|
1413 |
-
$
|
1414 |
-
$
|
1415 |
-
$
|
1416 |
-
$
|
1417 |
-
$
|
1418 |
-
$
|
1419 |
-
$
|
1420 |
-
$
|
|
|
1421 |
|
1422 |
$post_types[ $data['cpt_custom_post_type']['name'] ] = array(
|
1423 |
-
'name'
|
1424 |
-
'label'
|
1425 |
-
'singular_label'
|
1426 |
-
'description'
|
1427 |
-
'public'
|
1428 |
-
'publicly_queryable'
|
1429 |
-
'show_ui'
|
1430 |
-
'show_in_nav_menus'
|
1431 |
-
'show_in_rest'
|
1432 |
-
'rest_base'
|
1433 |
-
'
|
1434 |
-
'
|
1435 |
-
'
|
1436 |
-
'
|
1437 |
-
'
|
1438 |
-
'
|
1439 |
-
'
|
1440 |
-
'
|
1441 |
-
'
|
1442 |
-
'
|
1443 |
-
'
|
1444 |
-
'
|
1445 |
-
'
|
1446 |
-
'
|
1447 |
-
'
|
1448 |
-
'
|
1449 |
-
'
|
1450 |
-
'
|
|
|
1451 |
);
|
1452 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1453 |
/**
|
1454 |
* Filters whether or not 3rd party options were saved successfully within post type add/update.
|
1455 |
*
|
@@ -1626,7 +1690,7 @@ function cptui_check_page_slugs( $post_type_slug = '' ) {
|
|
1626 |
*/
|
1627 |
function cptui_process_post_type() {
|
1628 |
|
1629 |
-
if (
|
1630 |
return;
|
1631 |
}
|
1632 |
|
@@ -1649,8 +1713,11 @@ function cptui_process_post_type() {
|
|
1649 |
add_filter( 'cptui_post_type_deleted', '__return_true' );
|
1650 |
}
|
1651 |
|
|
|
1652 |
if ( $result ) {
|
1653 |
-
|
|
|
|
|
1654 |
}
|
1655 |
}
|
1656 |
}
|
@@ -1673,6 +1740,8 @@ function cptui_do_convert_post_type_posts() {
|
|
1673 |
* @param bool $value Whether or not to convert.
|
1674 |
*/
|
1675 |
if ( apply_filters( 'cptui_convert_post_type_posts', false ) ) {
|
|
|
|
|
1676 |
cptui_convert_post_type_posts( sanitize_text_field( $_POST['cpt_original'] ), sanitize_text_field( $_POST['cpt_custom_post_type']['name'] ) );
|
1677 |
}
|
1678 |
}
|
@@ -1691,7 +1760,7 @@ add_action( 'init', 'cptui_do_convert_post_type_posts' );
|
|
1691 |
function cptui_updated_post_type_slug_exists( $slug_exists, $post_type_slug = '', $post_types = array() ) {
|
1692 |
if (
|
1693 |
( ! empty( $_POST['cpt_type_status'] ) && 'edit' == $_POST['cpt_type_status'] ) &&
|
1694 |
-
! in_array( $post_type_slug,
|
1695 |
( ! empty( $_POST['cpt_original'] ) && $post_type_slug === $_POST['cpt_original'] )
|
1696 |
)
|
1697 |
{
|
6 |
* @subpackage PostTypes
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
29 |
return;
|
30 |
}
|
31 |
|
32 |
+
if ( wp_doing_ajax() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
wp_enqueue_media();
|
37 |
wp_enqueue_script( 'cptui' );
|
38 |
+
wp_enqueue_style( 'cptui-css' );
|
39 |
+
|
40 |
+
$core = get_post_types( array( '_builtin' => true ) );
|
41 |
+
$public = get_post_types( array( '_builtin' => false, 'public' => true ) );
|
42 |
+
$private = get_post_types( array( '_builtin' => false, 'public' => false ) );
|
43 |
+
$registered_post_types = array_merge( $core, $public, $private );
|
44 |
+
|
45 |
wp_localize_script( 'cptui', 'cptui_type_data',
|
46 |
array(
|
47 |
'confirm' => esc_html__( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'custom-post-type-ui' ),
|
48 |
+
'existing_post_types' => $registered_post_types,
|
49 |
)
|
50 |
);
|
51 |
}
|
64 |
*/
|
65 |
function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
|
66 |
|
67 |
+
if ( 'post_types' === $current_page ) {
|
68 |
$post_types = cptui_get_post_type_data();
|
69 |
$classes = array( 'nav-tab' );
|
70 |
|
125 |
*/
|
126 |
function cptui_manage_post_types() {
|
127 |
|
128 |
+
$tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) ? 'edit' : 'new';
|
129 |
+
$tab_class = 'cptui-' . $tab;
|
130 |
+
$current = null;
|
131 |
+
?>
|
132 |
|
133 |
<div class="wrap <?php echo esc_attr( $tab_class ); ?>">
|
134 |
|
158 |
*/
|
159 |
do_action( 'cptui_below_post_type_tab_menu' );
|
160 |
|
161 |
+
if ( 'edit' === $tab ) {
|
162 |
|
163 |
$post_types = cptui_get_post_type_data();
|
164 |
|
180 |
<?php
|
181 |
cptui_post_types_dropdown( $post_types );
|
182 |
|
183 |
+
wp_nonce_field( 'cptui_select_post_type_nonce_action', 'cptui_select_post_type_nonce_field' );
|
184 |
+
|
185 |
/**
|
186 |
* Filters the text value to use on the select post type button.
|
187 |
*
|
223 |
echo $ui->get_label( 'name', esc_html__( 'Post Type Slug', 'custom-post-type-ui' ) );
|
224 |
echo $ui->get_required_span();
|
225 |
|
226 |
+
if ( 'edit' === $tab ) {
|
227 |
+
echo '<p id="slugchanged" class="hidemessage">' . esc_html__( 'Slug has changed', 'custom-post-type-ui' ) . '<span class="dashicons dashicons-warning"></span></p>';
|
228 |
}
|
229 |
+
echo '<p id="slugexists" class="hidemessage">' . esc_html__( 'Slug already exists', 'custom-post-type-ui' ) . '<span class="dashicons dashicons-warning"></span></p>';
|
230 |
|
231 |
echo $ui->get_th_end() . $ui->get_td_start();
|
232 |
|
244 |
esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores should be used in place of spaces. Set "Custom Rewrite Slug" field to make slug use dashes for URLs.', 'custom-post-type-ui' );
|
245 |
echo '</p>';
|
246 |
|
247 |
+
if ( 'edit' === $tab ) {
|
248 |
echo '<p>';
|
249 |
esc_html_e( 'DO NOT EDIT the post type slug unless also planning to migrate posts. Changing the slug registers a new post type entry.', 'custom-post-type-ui' );
|
250 |
echo '</p>';
|
288 |
</table>
|
289 |
<p class="submit">
|
290 |
<?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
|
291 |
+
if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) { ?>
|
292 |
<?php
|
293 |
|
294 |
/**
|
326 |
<?php }
|
327 |
|
328 |
if ( ! empty( $current ) ) { ?>
|
329 |
+
<input type="hidden" name="cpt_original" id="cpt_original" value="<?php echo esc_attr( $current['name'] ); ?>" />
|
330 |
<?php }
|
331 |
|
332 |
// Used to check and see if we should prevent duplicate slugs. ?>
|
333 |
+
<input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php echo esc_attr( $tab ); ?>" />
|
334 |
</p>
|
335 |
</div>
|
336 |
</div>
|
568 |
'textvalue' => ( isset( $current['labels']['attributes'] ) ) ? esc_attr( $current['labels']['attributes'] ) : '',
|
569 |
'aftertext' => esc_html__( '(e.g. Movies Attributes)', 'custom-post-type-ui' ),
|
570 |
) );
|
571 |
+
|
572 |
+
echo $ui->get_text_input( array(
|
573 |
+
'labeltext' => esc_html__( '"New" menu in admin bar', 'custom-post-type-ui' ),
|
574 |
+
'helptext' => esc_html__( 'Used in New in Admin menu bar. Default "singular name" label.', 'custom-post-type-ui' ),
|
575 |
+
'namearray' => 'cpt_labels',
|
576 |
+
'name' => 'name_admin_bar',
|
577 |
+
'textvalue' => ( isset( $current['labels']['name_admin_bar'] ) ) ? esc_attr( $current['labels']['name_admin_bar'] ) : '',
|
578 |
+
'aftertext' => esc_html__( '(e.g. Movie)', 'custom-post-type-ui' ),
|
579 |
+
) );
|
580 |
+
|
581 |
?>
|
582 |
</table>
|
583 |
</div>
|
607 |
'namearray' => 'cpt_custom_post_type',
|
608 |
'name' => 'public',
|
609 |
'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),
|
610 |
+
'aftertext' => esc_html__( '(Custom Post Type UI default: true) Whether or not posts of this type should be shown in the admin UI and is publicly queryable.', 'custom-post-type-ui' ),
|
611 |
'selections' => $select,
|
612 |
) );
|
613 |
|
655 |
'namearray' => 'cpt_custom_post_type',
|
656 |
'name' => 'show_in_nav_menus',
|
657 |
'labeltext' => esc_html__( 'Show in Nav Menus', 'custom-post-type-ui' ),
|
658 |
+
'aftertext' => esc_html__( '(Custom Post Type UI default: true) Whether or not this post type is available for selection in navigation menus.', 'custom-post-type-ui' ),
|
659 |
'selections' => $select,
|
660 |
) );
|
661 |
|
662 |
$select = array(
|
663 |
'options' => array(
|
664 |
+
array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
|
665 |
+
array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'false' ),
|
666 |
),
|
667 |
);
|
668 |
$selected = ( isset( $current ) && ! empty( $current['show_in_rest'] ) ) ? disp_boolean( $current['show_in_rest'] ) : '';
|
671 |
'namearray' => 'cpt_custom_post_type',
|
672 |
'name' => 'show_in_rest',
|
673 |
'labeltext' => esc_html__( 'Show in REST API', 'custom-post-type-ui' ),
|
674 |
+
'aftertext' => esc_html__( '(Custom Post Type UI default: true) Whether or not to show this post type data in the WP REST API.', 'custom-post-type-ui' ),
|
675 |
'selections' => $select,
|
676 |
) );
|
677 |
|
683 |
'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
|
684 |
) );
|
685 |
|
686 |
+
echo $ui->get_text_input( array(
|
687 |
+
'namearray' => 'cpt_custom_post_type',
|
688 |
+
'name' => 'rest_controller_class',
|
689 |
+
'labeltext' => esc_html__( 'REST API controller class', 'custom-post-type-ui' ),
|
690 |
+
'aftertext' => esc_attr__( '(default: WP_REST_Posts_Controller) Custom controller to use instead of WP_REST_Posts_Controller.', 'custom-post-type-ui' ),
|
691 |
+
'textvalue' => ( isset( $current['rest_controller_class'] ) ) ? esc_attr( $current['rest_controller_class'] ) : '',
|
692 |
+
) );
|
693 |
+
|
694 |
echo $ui->get_tr_start() . $ui->get_th_start();
|
695 |
echo $ui->get_label( 'has_archive', esc_html__( 'Has Archive', 'custom-post-type-ui' ) );
|
696 |
echo $ui->get_p( esc_html__( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) );
|
745 |
'name' => 'capability_type',
|
746 |
'textvalue' => ( isset( $current['capability_type'] ) ) ? esc_attr( $current['capability_type'] ) : 'post',
|
747 |
'labeltext' => esc_html__( 'Capability Type', 'custom-post-type-ui' ),
|
748 |
+
'helptext' => esc_html__( 'The post type to use for checking read, edit, and delete capabilities. A comma-separated second value can be used for plural version.', 'custom-post-type-ui' ),
|
749 |
) );
|
750 |
|
751 |
$select = array(
|
801 |
'namearray' => 'cpt_custom_post_type',
|
802 |
'name' => 'rewrite_withfront',
|
803 |
'labeltext' => esc_html__( 'With Front', 'custom-post-type-ui' ),
|
804 |
+
'aftertext' => esc_html__( '(default: true) Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/).', 'custom-post-type-ui' ),
|
805 |
'selections' => $select,
|
806 |
) );
|
807 |
|
910 |
|
911 |
echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' );
|
912 |
|
913 |
+
echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right. A checked value means the post type means the feature is supported.', 'custom-post-type-ui' ) );
|
914 |
|
915 |
echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) );
|
916 |
|
1095 |
$args = array( 'public' => true );
|
1096 |
}
|
1097 |
|
1098 |
+
/**
|
1099 |
+
* Filters the results returned to display for available taxonomies for post type.
|
1100 |
+
*
|
1101 |
+
* @since 1.6.0
|
1102 |
+
*
|
1103 |
+
* @param array $value Array of taxonomy objects.
|
1104 |
+
* @param array $args Array of arguments for the taxonomies query.
|
1105 |
+
*/
|
1106 |
+
$add_taxes = apply_filters( 'cptui_get_taxonomies_for_post_types', get_taxonomies( $args, 'objects' ), $args );
|
1107 |
unset( $add_taxes['nav_menu'] ); unset( $add_taxes['post_format'] );
|
1108 |
foreach ( $add_taxes as $add_tax ) {
|
1109 |
|
1202 |
$current = cptui_get_current_post_type();
|
1203 |
|
1204 |
$select['selected'] = $current;
|
1205 |
+
|
1206 |
+
/**
|
1207 |
+
* Filters the post type dropdown options before rendering.
|
1208 |
+
* @since 1.6.0
|
1209 |
+
*
|
1210 |
+
* @param array $select Array of options for the dropdown.
|
1211 |
+
* @param array $post_types Array of original passed in post types.
|
1212 |
+
*/
|
1213 |
+
$select = apply_filters( 'cptui_post_types_dropdown_options', $select, $post_types );
|
1214 |
+
|
1215 |
echo $ui->get_select_input( array(
|
1216 |
'namearray' => 'cptui_selected_post_type',
|
1217 |
'name' => 'post_type',
|
1236 |
$type = false;
|
1237 |
|
1238 |
if ( ! empty( $_POST ) ) {
|
1239 |
+
if ( ! empty( $_POST['cptui_select_post_type_nonce_field'] ) ) {
|
1240 |
+
check_admin_referer( 'cptui_select_post_type_nonce_action', 'cptui_select_post_type_nonce_field' );
|
1241 |
+
}
|
1242 |
if ( isset( $_POST['cptui_selected_post_type']['post_type'] ) ) {
|
1243 |
$type = sanitize_text_field( $_POST['cptui_selected_post_type']['post_type'] );
|
1244 |
} else if ( $post_type_deleted ) {
|
1412 |
add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_post_type' );
|
1413 |
return 'error';
|
1414 |
}
|
|
|
1415 |
if ( 'new' == $data['cpt_type_status'] ) {
|
1416 |
$slug_as_page = cptui_check_page_slugs( $data['cpt_custom_post_type']['name'] );
|
1417 |
if ( true === $slug_as_page ) {
|
1459 |
$singular_label = htmlspecialchars( stripslashes( $singular_label ), ENT_QUOTES );
|
1460 |
}
|
1461 |
|
1462 |
+
$name = trim( $data['cpt_custom_post_type']['name'] );
|
1463 |
+
$description = stripslashes_deep( $data['cpt_custom_post_type']['description'] );
|
1464 |
+
$rest_base = trim( $data['cpt_custom_post_type']['rest_base'] );
|
1465 |
+
$rest_controller_class = trim( $data['cpt_custom_post_type']['rest_controller_class'] );
|
1466 |
+
$has_archive_string = trim( $data['cpt_custom_post_type']['has_archive_string'] );
|
1467 |
+
$capability_type = trim( $data['cpt_custom_post_type']['capability_type'] );
|
1468 |
+
$rewrite_slug = trim( $data['cpt_custom_post_type']['rewrite_slug'] );
|
1469 |
+
$query_var_slug = trim( $data['cpt_custom_post_type']['query_var_slug'] );
|
1470 |
+
$menu_position = trim( $data['cpt_custom_post_type']['menu_position'] );
|
1471 |
+
$show_in_menu_string = trim( $data['cpt_custom_post_type']['show_in_menu_string'] );
|
1472 |
+
$menu_icon = trim( $data['cpt_custom_post_type']['menu_icon'] );
|
1473 |
+
$custom_supports = trim( $data['cpt_custom_post_type']['custom_supports'] );
|
1474 |
|
1475 |
$post_types[ $data['cpt_custom_post_type']['name'] ] = array(
|
1476 |
+
'name' => $name,
|
1477 |
+
'label' => $label,
|
1478 |
+
'singular_label' => $singular_label,
|
1479 |
+
'description' => $description,
|
1480 |
+
'public' => disp_boolean( $data['cpt_custom_post_type']['public'] ),
|
1481 |
+
'publicly_queryable' => disp_boolean( $data['cpt_custom_post_type']['publicly_queryable'] ),
|
1482 |
+
'show_ui' => disp_boolean( $data['cpt_custom_post_type']['show_ui'] ),
|
1483 |
+
'show_in_nav_menus' => disp_boolean( $data['cpt_custom_post_type']['show_in_nav_menus'] ),
|
1484 |
+
'show_in_rest' => disp_boolean( $data['cpt_custom_post_type']['show_in_rest'] ),
|
1485 |
+
'rest_base' => $rest_base,
|
1486 |
+
'rest_controller_class' => $rest_controller_class,
|
1487 |
+
'has_archive' => disp_boolean( $data['cpt_custom_post_type']['has_archive'] ),
|
1488 |
+
'has_archive_string' => $has_archive_string,
|
1489 |
+
'exclude_from_search' => disp_boolean( $data['cpt_custom_post_type']['exclude_from_search'] ),
|
1490 |
+
'capability_type' => $capability_type,
|
1491 |
+
'hierarchical' => disp_boolean( $data['cpt_custom_post_type']['hierarchical'] ),
|
1492 |
+
'rewrite' => disp_boolean( $data['cpt_custom_post_type']['rewrite'] ),
|
1493 |
+
'rewrite_slug' => $rewrite_slug,
|
1494 |
+
'rewrite_withfront' => disp_boolean( $data['cpt_custom_post_type']['rewrite_withfront'] ),
|
1495 |
+
'query_var' => disp_boolean( $data['cpt_custom_post_type']['query_var'] ),
|
1496 |
+
'query_var_slug' => $query_var_slug,
|
1497 |
+
'menu_position' => $menu_position,
|
1498 |
+
'show_in_menu' => disp_boolean( $data['cpt_custom_post_type']['show_in_menu'] ),
|
1499 |
+
'show_in_menu_string' => $show_in_menu_string,
|
1500 |
+
'menu_icon' => $menu_icon,
|
1501 |
+
'supports' => $data['cpt_supports'],
|
1502 |
+
'taxonomies' => $data['cpt_addon_taxes'],
|
1503 |
+
'labels' => $data['cpt_labels'],
|
1504 |
+
'custom_supports' => $custom_supports,
|
1505 |
);
|
1506 |
|
1507 |
+
/**
|
1508 |
+
* Filters final data to be saved right before saving post type data.
|
1509 |
+
*
|
1510 |
+
* @since 1.6.0
|
1511 |
+
*
|
1512 |
+
* @param array $post_types Array of final post type data to save.
|
1513 |
+
* @param string $name Post type slug for post type being saved.
|
1514 |
+
*/
|
1515 |
+
$post_types = apply_filters( 'cptui_pre_save_post_type', $post_types, $name );
|
1516 |
+
|
1517 |
/**
|
1518 |
* Filters whether or not 3rd party options were saved successfully within post type add/update.
|
1519 |
*
|
1690 |
*/
|
1691 |
function cptui_process_post_type() {
|
1692 |
|
1693 |
+
if ( wp_doing_ajax() ) {
|
1694 |
return;
|
1695 |
}
|
1696 |
|
1713 |
add_filter( 'cptui_post_type_deleted', '__return_true' );
|
1714 |
}
|
1715 |
|
1716 |
+
// @TODO Utilize anonymous function to admin_notice `$result` if it happens to error.
|
1717 |
if ( $result ) {
|
1718 |
+
if ( is_callable( "cptui_{$result}_admin_notice" ) ) {
|
1719 |
+
add_action( 'admin_notices', "cptui_{$result}_admin_notice" );
|
1720 |
+
}
|
1721 |
}
|
1722 |
}
|
1723 |
}
|
1740 |
* @param bool $value Whether or not to convert.
|
1741 |
*/
|
1742 |
if ( apply_filters( 'cptui_convert_post_type_posts', false ) ) {
|
1743 |
+
check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
|
1744 |
+
|
1745 |
cptui_convert_post_type_posts( sanitize_text_field( $_POST['cpt_original'] ), sanitize_text_field( $_POST['cpt_custom_post_type']['name'] ) );
|
1746 |
}
|
1747 |
}
|
1760 |
function cptui_updated_post_type_slug_exists( $slug_exists, $post_type_slug = '', $post_types = array() ) {
|
1761 |
if (
|
1762 |
( ! empty( $_POST['cpt_type_status'] ) && 'edit' == $_POST['cpt_type_status'] ) &&
|
1763 |
+
! in_array( $post_type_slug, cptui_reserved_post_types() ) &&
|
1764 |
( ! empty( $_POST['cpt_original'] ) && $post_type_slug === $_POST['cpt_original'] )
|
1765 |
)
|
1766 |
{
|
inc/support.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage Support
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -28,11 +29,12 @@ function cptui_support_enqueue_scripts() {
|
|
28 |
return;
|
29 |
}
|
30 |
|
31 |
-
if (
|
32 |
return;
|
33 |
}
|
34 |
|
35 |
wp_enqueue_script( 'cptui' );
|
|
|
36 |
}
|
37 |
add_action( 'admin_enqueue_scripts', 'cptui_support_enqueue_scripts' );
|
38 |
|
@@ -67,7 +69,7 @@ function cptui_support() {
|
|
67 |
|
68 |
<table id="support" class="form-table cptui-table">
|
69 |
<tr>
|
70 |
-
<td class="
|
71 |
<h2><?php esc_html_e( 'Pluginize', 'custom-post-type-ui' ); ?></h2>
|
72 |
<ol id="questions_pluginize">
|
73 |
<li>
|
@@ -115,7 +117,7 @@ function cptui_support() {
|
|
115 |
</li>
|
116 |
</ol>
|
117 |
</td>
|
118 |
-
<td class="
|
119 |
<h2><?php esc_html_e( 'General', 'custom-post-type-ui' ); ?></h2>
|
120 |
<ol id="questions_general">
|
121 |
<li>
|
@@ -144,7 +146,7 @@ function cptui_support() {
|
|
144 |
</div>
|
145 |
</li>
|
146 |
<li>
|
147 |
-
<span tabindex="0" class="question" aria-controls="q13" aria-expanded="false"><?php esc_html_e( 'Is there any way to get
|
148 |
|
149 |
<div class="answer" id="q13"><?php esc_html_e( 'Please see the solution from the following forum support thread.', 'custom-post-type-ui' ); ?>
|
150 |
<a href="https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458" target="_blank">https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458</a>
|
@@ -153,7 +155,7 @@ function cptui_support() {
|
|
153 |
<li>
|
154 |
<span tabindex="0" class="question" aria-controls="q14" aria-expanded="false"><?php esc_html_e( 'Why can I not use dashes in post type or taxonomy slugs?', 'custom-post-type-ui' ); ?></span>
|
155 |
|
156 |
-
<div class="answer" id="q14"><?php esc_html_e( '
|
157 |
<a href="http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo" target="_blank">http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo</a>
|
158 |
</div>
|
159 |
</li>
|
@@ -161,7 +163,7 @@ function cptui_support() {
|
|
161 |
</td>
|
162 |
</tr>
|
163 |
<tr>
|
164 |
-
<td class="
|
165 |
<h2><?php esc_html_e( 'Front-end Display', 'custom-post-type-ui' ); ?></h2>
|
166 |
<ol id="questions_front">
|
167 |
<li>
|
@@ -200,7 +202,7 @@ function cptui_support() {
|
|
200 |
</li>
|
201 |
</ol>
|
202 |
</td>
|
203 |
-
<td class="
|
204 |
<h2><?php esc_html_e( 'Advanced', 'custom-post-type-ui' ); ?></h2>
|
205 |
<ol id="questions_advanced">
|
206 |
<li>
|
@@ -253,9 +255,16 @@ function cptui_support() {
|
|
253 |
add_filter( 'enter_title_here', 'my_custom_title_text' );
|
254 |
</code></pre></div>
|
255 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
</ol>
|
257 |
</td>
|
258 |
-
<td class="
|
259 |
|
260 |
<?php
|
261 |
|
6 |
* @subpackage Support
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
29 |
return;
|
30 |
}
|
31 |
|
32 |
+
if ( wp_doing_ajax() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
wp_enqueue_script( 'cptui' );
|
37 |
+
wp_enqueue_style( 'cptui-css' );
|
38 |
}
|
39 |
add_action( 'admin_enqueue_scripts', 'cptui_support_enqueue_scripts' );
|
40 |
|
69 |
|
70 |
<table id="support" class="form-table cptui-table">
|
71 |
<tr>
|
72 |
+
<td class="outer">
|
73 |
<h2><?php esc_html_e( 'Pluginize', 'custom-post-type-ui' ); ?></h2>
|
74 |
<ol id="questions_pluginize">
|
75 |
<li>
|
117 |
</li>
|
118 |
</ol>
|
119 |
</td>
|
120 |
+
<td class="outer">
|
121 |
<h2><?php esc_html_e( 'General', 'custom-post-type-ui' ); ?></h2>
|
122 |
<ol id="questions_general">
|
123 |
<li>
|
146 |
</div>
|
147 |
</li>
|
148 |
<li>
|
149 |
+
<span tabindex="0" class="question" aria-controls="q13" aria-expanded="false"><?php esc_html_e( 'Is there any way to get Custom Post Type UI-registered post types working with Visual Composer Media Grid?', 'custom-post-type-ui' ); ?></span>
|
150 |
|
151 |
<div class="answer" id="q13"><?php esc_html_e( 'Please see the solution from the following forum support thread.', 'custom-post-type-ui' ); ?>
|
152 |
<a href="https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458" target="_blank">https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458</a>
|
155 |
<li>
|
156 |
<span tabindex="0" class="question" aria-controls="q14" aria-expanded="false"><?php esc_html_e( 'Why can I not use dashes in post type or taxonomy slugs?', 'custom-post-type-ui' ); ?></span>
|
157 |
|
158 |
+
<div class="answer" id="q14"><?php esc_html_e( 'Custom Post Type UI tries to make smart choices for our users, and forcing underscores is one of them. Please see the tutorial at the following URL for how to get dashes in your permalink urls while continuing to use underscores for the actual slug.', 'custom-post-type-ui' ); ?>
|
159 |
<a href="http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo" target="_blank">http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo</a>
|
160 |
</div>
|
161 |
</li>
|
163 |
</td>
|
164 |
</tr>
|
165 |
<tr>
|
166 |
+
<td class="outer">
|
167 |
<h2><?php esc_html_e( 'Front-end Display', 'custom-post-type-ui' ); ?></h2>
|
168 |
<ol id="questions_front">
|
169 |
<li>
|
202 |
</li>
|
203 |
</ol>
|
204 |
</td>
|
205 |
+
<td class="outer">
|
206 |
<h2><?php esc_html_e( 'Advanced', 'custom-post-type-ui' ); ?></h2>
|
207 |
<ol id="questions_advanced">
|
208 |
<li>
|
255 |
add_filter( 'enter_title_here', 'my_custom_title_text' );
|
256 |
</code></pre></div>
|
257 |
</li>
|
258 |
+
<li>
|
259 |
+
<span tabindex="0" class="question" aria-controls="q23" aria-expanded="false"><?php esc_html_e( 'Any help with customizing capabilities?', 'custom-post-type-ui' ); ?></span>
|
260 |
+
<div class="answer" id="q23">
|
261 |
+
<p><?php printf( esc_html__( 'We recommend %s for some extended customization and addition of extra fields regarding roles and capabilities.', 'custom-post-type-ui' ),
|
262 |
+
'<a href="https://github.com/tw2113/custom-post-type-ui-capabilities" target="_blank">Custom Post Type UI Capabilities on GitHub</a>' ); ?></p>
|
263 |
+
</div>
|
264 |
+
</li>
|
265 |
</ol>
|
266 |
</td>
|
267 |
+
<td class="outer">
|
268 |
|
269 |
<?php
|
270 |
|
inc/taxonomies.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage Taxonomies
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -28,15 +29,22 @@ function cptui_taxonomies_enqueue_scripts() {
|
|
28 |
return;
|
29 |
}
|
30 |
|
31 |
-
if (
|
32 |
return;
|
33 |
}
|
34 |
|
35 |
wp_enqueue_script( 'cptui' );
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
array(
|
38 |
-
'confirm'
|
39 |
-
'no_associated_type' => esc_html( 'Please select a post type to associate with.', 'custom-post-type-ui' )
|
|
|
40 |
)
|
41 |
);
|
42 |
}
|
@@ -117,8 +125,10 @@ add_filter( 'cptui_get_tabs', 'cptui_taxonomy_tabs', 10, 2 );
|
|
117 |
*/
|
118 |
function cptui_manage_taxonomies() {
|
119 |
|
120 |
-
$tab
|
121 |
-
$tab_class = 'cptui-' . $tab;
|
|
|
|
|
122 |
|
123 |
<div class="wrap <?php echo esc_attr( $tab_class ); ?>">
|
124 |
|
@@ -140,7 +150,7 @@ function cptui_manage_taxonomies() {
|
|
140 |
$taxonomy_deleted = apply_filters( 'cptui_taxonomy_deleted', false );
|
141 |
|
142 |
// Create our tabs.
|
143 |
-
cptui_settings_tab_menu(
|
144 |
|
145 |
/**
|
146 |
* Fires below the output for the tab menu on the taxonomy add/edit screen.
|
@@ -171,6 +181,8 @@ function cptui_manage_taxonomies() {
|
|
171 |
<?php
|
172 |
cptui_taxonomies_dropdown( $taxonomies );
|
173 |
|
|
|
|
|
174 |
/**
|
175 |
* Filters the text value to use on the select taxonomy button.
|
176 |
*
|
@@ -212,8 +224,10 @@ function cptui_manage_taxonomies() {
|
|
212 |
echo $ui->get_label( 'name', esc_html__( 'Taxonomy Slug', 'custom-post-type-ui' ) ) . $ui->get_required_span();
|
213 |
|
214 |
if ( 'edit' == $tab ) {
|
215 |
-
echo '<p id="slugchanged" class="hidemessage">' .
|
216 |
}
|
|
|
|
|
217 |
echo $ui->get_th_end() . $ui->get_td_start();
|
218 |
|
219 |
echo $ui->get_text_input( array(
|
@@ -273,7 +287,7 @@ function cptui_manage_taxonomies() {
|
|
273 |
echo $ui->get_td_end() . $ui->get_tr_end();
|
274 |
|
275 |
echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Attach to Post Type', 'custom-post-type-ui' ) . $ui->get_required_span();
|
276 |
-
echo $ui->get_p( esc_html__( 'Add support for available registered post types. At least one is required.', 'custom-post-type-ui' ) );
|
277 |
echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
|
278 |
|
279 |
/**
|
@@ -335,7 +349,7 @@ function cptui_manage_taxonomies() {
|
|
335 |
* @param string $value Text to use for the button.
|
336 |
*/
|
337 |
?>
|
338 |
-
<input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', esc_attr__( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
|
339 |
<?php
|
340 |
|
341 |
/**
|
@@ -579,11 +593,7 @@ function cptui_manage_taxonomies() {
|
|
579 |
$select = array(
|
580 |
'options' => array(
|
581 |
array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
|
582 |
-
array(
|
583 |
-
'attr' => '1',
|
584 |
-
'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
|
585 |
-
'default' => 'true'
|
586 |
-
),
|
587 |
),
|
588 |
);
|
589 |
$selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : '';
|
@@ -592,7 +602,23 @@ function cptui_manage_taxonomies() {
|
|
592 |
'namearray' => 'cpt_custom_tax',
|
593 |
'name' => 'public',
|
594 |
'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),
|
595 |
-
'aftertext' => esc_html__( '(default: true) Whether
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
'selections' => $select,
|
597 |
) );
|
598 |
|
@@ -822,6 +848,14 @@ function cptui_manage_taxonomies() {
|
|
822 |
'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
|
823 |
) );
|
824 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
$select = array(
|
826 |
'options' => array(
|
827 |
array(
|
@@ -841,6 +875,14 @@ function cptui_manage_taxonomies() {
|
|
841 |
'aftertext' => esc_html__( '(default: false) Whether to show the taxonomy in the quick/bulk edit panel.', 'custom-post-type-ui' ),
|
842 |
'selections' => $select,
|
843 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
?>
|
845 |
</table>
|
846 |
</div>
|
@@ -893,7 +935,7 @@ function cptui_manage_taxonomies() {
|
|
893 |
* @param string $value Text to use for the button.
|
894 |
*/
|
895 |
?>
|
896 |
-
<input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', esc_attr__( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
|
897 |
<?php } ?>
|
898 |
|
899 |
<?php if ( ! empty( $current ) ) { ?>
|
@@ -933,6 +975,17 @@ function cptui_taxonomies_dropdown( $taxonomies = array() ) {
|
|
933 |
$current = cptui_get_current_taxonomy();
|
934 |
|
935 |
$select['selected'] = $current;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
936 |
echo $ui->get_select_input( array(
|
937 |
'namearray' => 'cptui_selected_taxonomy',
|
938 |
'name' => 'taxonomy',
|
@@ -957,6 +1010,9 @@ function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
|
|
957 |
$tax = false;
|
958 |
|
959 |
if ( ! empty( $_POST ) ) {
|
|
|
|
|
|
|
960 |
if ( isset( $_POST['cptui_selected_taxonomy']['taxonomy'] ) ) {
|
961 |
$tax = sanitize_text_field( $_POST['cptui_selected_taxonomy']['taxonomy'] );
|
962 |
} else if ( $taxonomy_deleted ) {
|
@@ -1090,7 +1146,8 @@ function cptui_update_taxonomy( $data = array() ) {
|
|
1090 |
}
|
1091 |
|
1092 |
if ( empty( $data['cpt_post_types'] ) ) {
|
1093 |
-
|
|
|
1094 |
}
|
1095 |
|
1096 |
if ( ! empty( $data['tax_original'] ) && $data['tax_original'] != $data['cpt_custom_tax']['name'] ) {
|
@@ -1156,37 +1213,52 @@ function cptui_update_taxonomy( $data = array() ) {
|
|
1156 |
$singular_label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_tax']['singular_label'] ) );
|
1157 |
$singular_label = htmlspecialchars( stripslashes( $singular_label ) );
|
1158 |
}
|
1159 |
-
$description
|
1160 |
-
$query_var_slug
|
1161 |
-
$rewrite_slug
|
1162 |
-
$rest_base
|
1163 |
-
$
|
|
|
|
|
1164 |
|
1165 |
$taxonomies[ $data['cpt_custom_tax']['name'] ] = array(
|
1166 |
-
'name'
|
1167 |
-
'label'
|
1168 |
-
'singular_label'
|
1169 |
-
'description'
|
1170 |
-
'public'
|
1171 |
-
'
|
1172 |
-
'
|
1173 |
-
'
|
1174 |
-
'
|
1175 |
-
'
|
1176 |
-
'
|
1177 |
-
'
|
1178 |
-
'
|
1179 |
-
'
|
1180 |
-
'
|
1181 |
-
'
|
1182 |
-
'
|
1183 |
-
'
|
1184 |
-
'
|
1185 |
-
'
|
|
|
|
|
|
|
1186 |
);
|
1187 |
|
1188 |
$taxonomies[ $data['cpt_custom_tax']['name'] ]['object_types'] = $data['cpt_post_types'];
|
1189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1190 |
/**
|
1191 |
* Filters whether or not 3rd party options were saved successfully within taxonomy add/update.
|
1192 |
*
|
@@ -1402,7 +1474,9 @@ function cptui_check_existing_taxonomy_slugs( $slug_exists = false, $taxonomy_sl
|
|
1402 |
}
|
1403 |
|
1404 |
// Check if other plugins have registered this same slug.
|
1405 |
-
$
|
|
|
|
|
1406 |
if ( in_array( $taxonomy_slug, $registered_taxonomies ) ) {
|
1407 |
return true;
|
1408 |
}
|
@@ -1419,7 +1493,7 @@ add_filter( 'cptui_taxonomy_slug_exists', 'cptui_check_existing_taxonomy_slugs',
|
|
1419 |
*/
|
1420 |
function cptui_process_taxonomy() {
|
1421 |
|
1422 |
-
if (
|
1423 |
return;
|
1424 |
}
|
1425 |
|
@@ -1441,8 +1515,12 @@ function cptui_process_taxonomy() {
|
|
1441 |
$result = cptui_delete_taxonomy( $_POST );
|
1442 |
add_filter( 'cptui_taxonomy_deleted', '__return_true' );
|
1443 |
}
|
|
|
|
|
1444 |
if ( $result ) {
|
1445 |
-
|
|
|
|
|
1446 |
}
|
1447 |
}
|
1448 |
}
|
@@ -1465,6 +1543,8 @@ function cptui_do_convert_taxonomy_terms() {
|
|
1465 |
* @param bool $value Whether or not to convert.
|
1466 |
*/
|
1467 |
if ( apply_filters( 'cptui_convert_taxonomy_terms', false ) ) {
|
|
|
|
|
1468 |
cptui_convert_taxonomy_terms( sanitize_text_field( $_POST['tax_original'] ), sanitize_text_field( $_POST['cpt_custom_tax']['name'] ) );
|
1469 |
}
|
1470 |
}
|
6 |
* @subpackage Taxonomies
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
29 |
return;
|
30 |
}
|
31 |
|
32 |
+
if ( wp_doing_ajax() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
wp_enqueue_script( 'cptui' );
|
37 |
+
wp_enqueue_style( 'cptui-css' );
|
38 |
+
|
39 |
+
$core = get_taxonomies( array( '_builtin' => true ) );
|
40 |
+
$public = get_taxonomies( array( '_builtin' => false, 'public' => true ) );
|
41 |
+
$private = get_taxonomies( array( '_builtin' => false, 'public' => false ) );
|
42 |
+
$registered_taxonomies = array_merge( $core, $public, $private );
|
43 |
+
wp_localize_script( 'cptui', 'cptui_tax_data',
|
44 |
array(
|
45 |
+
'confirm' => esc_html__( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'custom-post-type-ui' ),
|
46 |
+
'no_associated_type' => esc_html( 'Please select a post type to associate with.', 'custom-post-type-ui' ),
|
47 |
+
'existing_taxonomies' => $registered_taxonomies,
|
48 |
)
|
49 |
);
|
50 |
}
|
125 |
*/
|
126 |
function cptui_manage_taxonomies() {
|
127 |
|
128 |
+
$tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) ? 'edit' : 'new';
|
129 |
+
$tab_class = 'cptui-' . $tab;
|
130 |
+
$current = null;
|
131 |
+
?>
|
132 |
|
133 |
<div class="wrap <?php echo esc_attr( $tab_class ); ?>">
|
134 |
|
150 |
$taxonomy_deleted = apply_filters( 'cptui_taxonomy_deleted', false );
|
151 |
|
152 |
// Create our tabs.
|
153 |
+
cptui_settings_tab_menu( 'taxonomies' );
|
154 |
|
155 |
/**
|
156 |
* Fires below the output for the tab menu on the taxonomy add/edit screen.
|
181 |
<?php
|
182 |
cptui_taxonomies_dropdown( $taxonomies );
|
183 |
|
184 |
+
wp_nonce_field( 'cptui_select_taxonomy_nonce_action', 'cptui_select_taxonomy_nonce_field' );
|
185 |
+
|
186 |
/**
|
187 |
* Filters the text value to use on the select taxonomy button.
|
188 |
*
|
224 |
echo $ui->get_label( 'name', esc_html__( 'Taxonomy Slug', 'custom-post-type-ui' ) ) . $ui->get_required_span();
|
225 |
|
226 |
if ( 'edit' == $tab ) {
|
227 |
+
echo '<p id="slugchanged" class="hidemessage">' . esc_html__( 'Slug has changed', 'custom-post-type-ui' ) . '<span class="dashicons dashicons-warning"></span></p>';
|
228 |
}
|
229 |
+
echo '<p id="slugexists" class="hidemessage">' . esc_html__( 'Slug already exists', 'custom-post-type-ui' ) . '<span class="dashicons dashicons-warning"></span></p>';
|
230 |
+
|
231 |
echo $ui->get_th_end() . $ui->get_td_start();
|
232 |
|
233 |
echo $ui->get_text_input( array(
|
287 |
echo $ui->get_td_end() . $ui->get_tr_end();
|
288 |
|
289 |
echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Attach to Post Type', 'custom-post-type-ui' ) . $ui->get_required_span();
|
290 |
+
echo $ui->get_p( esc_html__( 'Add support for available registered post types. At least one is required. Only public post types listed by default.', 'custom-post-type-ui' ) );
|
291 |
echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
|
292 |
|
293 |
/**
|
349 |
* @param string $value Text to use for the button.
|
350 |
*/
|
351 |
?>
|
352 |
+
<input type="submit" class="button-primary cptui-taxonomy-submit" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', esc_attr__( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
|
353 |
<?php
|
354 |
|
355 |
/**
|
593 |
$select = array(
|
594 |
'options' => array(
|
595 |
array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
|
596 |
+
array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
|
|
|
|
|
|
|
|
|
597 |
),
|
598 |
);
|
599 |
$selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : '';
|
602 |
'namearray' => 'cpt_custom_tax',
|
603 |
'name' => 'public',
|
604 |
'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),
|
605 |
+
'aftertext' => esc_html__( '(default: true) Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.', 'custom-post-type-ui' ),
|
606 |
+
'selections' => $select,
|
607 |
+
) );
|
608 |
+
|
609 |
+
$select = array(
|
610 |
+
'options' => array(
|
611 |
+
array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
|
612 |
+
array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
|
613 |
+
),
|
614 |
+
);
|
615 |
+
$selected = ( isset( $current ) ) ? disp_boolean( $current['publicly_queryable'] ) : '';
|
616 |
+
$select['selected'] = ( ! empty( $selected ) ) ? $current['publicly_queryable'] : '';
|
617 |
+
echo $ui->get_select_input( array(
|
618 |
+
'namearray' => 'cpt_custom_tax',
|
619 |
+
'name' => 'publicly_queryable',
|
620 |
+
'labeltext' => esc_html__( 'Public Queryable', 'custom-post-type-ui' ),
|
621 |
+
'aftertext' => esc_html__( '(default: value of "public" setting) Whether or not the taxonomy should be publicly queryable.', 'custom-post-type-ui' ),
|
622 |
'selections' => $select,
|
623 |
) );
|
624 |
|
848 |
'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
|
849 |
) );
|
850 |
|
851 |
+
echo $ui->get_text_input( array(
|
852 |
+
'namearray' => 'cpt_custom_tax',
|
853 |
+
'name' => 'rest_controller_class',
|
854 |
+
'labeltext' => esc_html__( 'REST API controller class', 'custom-post-type-ui' ),
|
855 |
+
'aftertext' => esc_attr__( '(default: WP_REST_Terms_Controller) Custom controller to use instead of WP_REST_Terms_Controller.', 'custom-post-type-ui' ),
|
856 |
+
'textvalue' => ( isset( $current['rest_controller_class'] ) ) ? esc_attr( $current['rest_controller_class'] ) : '',
|
857 |
+
) );
|
858 |
+
|
859 |
$select = array(
|
860 |
'options' => array(
|
861 |
array(
|
875 |
'aftertext' => esc_html__( '(default: false) Whether to show the taxonomy in the quick/bulk edit panel.', 'custom-post-type-ui' ),
|
876 |
'selections' => $select,
|
877 |
) );
|
878 |
+
|
879 |
+
echo $ui->get_text_input( array(
|
880 |
+
'namearray' => 'cpt_custom_tax',
|
881 |
+
'name' => 'meta_box_cb',
|
882 |
+
'textvalue' => ( isset( $current['meta_box_cb'] ) ) ? esc_attr( $current['meta_box_cb'] ) : '',
|
883 |
+
'labeltext' => esc_html__( 'Metabox callback', 'custom-post-type-ui' ),
|
884 |
+
'helptext' => esc_html__( 'Sets a callback function name for the meta box display. Hierarchical default: post_categories_meta_box, non-hierarchical default: post_tags_meta_box.', 'custom-post-type-ui' ),
|
885 |
+
) );
|
886 |
?>
|
887 |
</table>
|
888 |
</div>
|
935 |
* @param string $value Text to use for the button.
|
936 |
*/
|
937 |
?>
|
938 |
+
<input type="submit" class="button-primary cptui-taxonomy-submit" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', esc_attr__( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
|
939 |
<?php } ?>
|
940 |
|
941 |
<?php if ( ! empty( $current ) ) { ?>
|
975 |
$current = cptui_get_current_taxonomy();
|
976 |
|
977 |
$select['selected'] = $current;
|
978 |
+
|
979 |
+
/**
|
980 |
+
* Filters the taxonomy dropdown options before rendering.
|
981 |
+
*
|
982 |
+
* @since 1.6.0
|
983 |
+
*
|
984 |
+
* @param array $select Array of options for the dropdown.
|
985 |
+
* @param array $taxonomies Array of original passed in post types.
|
986 |
+
*/
|
987 |
+
$select = apply_filters( 'cptui_taxonomies_dropdown_options', $select, $taxonomies );
|
988 |
+
|
989 |
echo $ui->get_select_input( array(
|
990 |
'namearray' => 'cptui_selected_taxonomy',
|
991 |
'name' => 'taxonomy',
|
1010 |
$tax = false;
|
1011 |
|
1012 |
if ( ! empty( $_POST ) ) {
|
1013 |
+
if ( ! empty( $_POST['cptui_select_taxonomy_nonce_field'] ) ) {
|
1014 |
+
check_admin_referer( 'cptui_select_taxonomy_nonce_action', 'cptui_select_taxonomy_nonce_field' );
|
1015 |
+
}
|
1016 |
if ( isset( $_POST['cptui_selected_taxonomy']['taxonomy'] ) ) {
|
1017 |
$tax = sanitize_text_field( $_POST['cptui_selected_taxonomy']['taxonomy'] );
|
1018 |
} else if ( $taxonomy_deleted ) {
|
1146 |
}
|
1147 |
|
1148 |
if ( empty( $data['cpt_post_types'] ) ) {
|
1149 |
+
add_filter( 'cptui_custom_error_message', 'cptui_empty_cpt_on_taxonomy' );
|
1150 |
+
return 'error';
|
1151 |
}
|
1152 |
|
1153 |
if ( ! empty( $data['tax_original'] ) && $data['tax_original'] != $data['cpt_custom_tax']['name'] ) {
|
1213 |
$singular_label = str_replace( '"', '', htmlspecialchars_decode( $data['cpt_custom_tax']['singular_label'] ) );
|
1214 |
$singular_label = htmlspecialchars( stripslashes( $singular_label ) );
|
1215 |
}
|
1216 |
+
$description = stripslashes_deep( $data['cpt_custom_tax']['description'] );
|
1217 |
+
$query_var_slug = trim( $data['cpt_custom_tax']['query_var_slug'] );
|
1218 |
+
$rewrite_slug = trim( $data['cpt_custom_tax']['rewrite_slug'] );
|
1219 |
+
$rest_base = trim( $data['cpt_custom_tax']['rest_base'] );
|
1220 |
+
$rest_controller_class = trim( $data['cpt_custom_tax']['rest_controller_class'] );
|
1221 |
+
$show_quickpanel_bulk = ( ! empty( $data['cpt_custom_tax']['show_in_quick_edit'] ) ) ? disp_boolean( $data['cpt_custom_tax']['show_in_quick_edit'] ) : '';
|
1222 |
+
$meta_box_cb = trim( $data['cpt_custom_tax']['meta_box_cb'] );
|
1223 |
|
1224 |
$taxonomies[ $data['cpt_custom_tax']['name'] ] = array(
|
1225 |
+
'name' => $name,
|
1226 |
+
'label' => $label,
|
1227 |
+
'singular_label' => $singular_label,
|
1228 |
+
'description' => $description,
|
1229 |
+
'public' => disp_boolean( $data['cpt_custom_tax']['public'] ),
|
1230 |
+
'publicly_queryable' => disp_boolean( $data['cpt_custom_tax']['publicly_queryable'] ),
|
1231 |
+
'hierarchical' => disp_boolean( $data['cpt_custom_tax']['hierarchical'] ),
|
1232 |
+
'show_ui' => disp_boolean( $data['cpt_custom_tax']['show_ui'] ),
|
1233 |
+
'show_in_menu' => disp_boolean( $data['cpt_custom_tax']['show_in_menu'] ),
|
1234 |
+
'show_in_nav_menus' => disp_boolean( $data['cpt_custom_tax']['show_in_nav_menus'] ),
|
1235 |
+
'query_var' => disp_boolean( $data['cpt_custom_tax']['query_var'] ),
|
1236 |
+
'query_var_slug' => $query_var_slug,
|
1237 |
+
'rewrite' => disp_boolean( $data['cpt_custom_tax']['rewrite'] ),
|
1238 |
+
'rewrite_slug' => $rewrite_slug,
|
1239 |
+
'rewrite_withfront' => $data['cpt_custom_tax']['rewrite_withfront'],
|
1240 |
+
'rewrite_hierarchical' => $data['cpt_custom_tax']['rewrite_hierarchical'],
|
1241 |
+
'show_admin_column' => disp_boolean( $data['cpt_custom_tax']['show_admin_column'] ),
|
1242 |
+
'show_in_rest' => disp_boolean( $data['cpt_custom_tax']['show_in_rest'] ),
|
1243 |
+
'show_in_quick_edit' => $show_quickpanel_bulk,
|
1244 |
+
'rest_base' => $rest_base,
|
1245 |
+
'rest_controller_class' => $rest_controller_class,
|
1246 |
+
'labels' => $data['cpt_tax_labels'],
|
1247 |
+
'meta_box_cb' => $meta_box_cb,
|
1248 |
);
|
1249 |
|
1250 |
$taxonomies[ $data['cpt_custom_tax']['name'] ]['object_types'] = $data['cpt_post_types'];
|
1251 |
|
1252 |
+
/**
|
1253 |
+
* Filters final data to be saved right before saving taxoomy data.
|
1254 |
+
*
|
1255 |
+
* @since 1.6.0
|
1256 |
+
*
|
1257 |
+
* @param array $taxonomies Array of final taxonomy data to save.
|
1258 |
+
* @param string $name Taxonomy slug for taxonomy being saved.
|
1259 |
+
*/
|
1260 |
+
$taxonomies = apply_filters( 'cptui_pre_save_taxonomy', $taxonomies, $name );
|
1261 |
+
|
1262 |
/**
|
1263 |
* Filters whether or not 3rd party options were saved successfully within taxonomy add/update.
|
1264 |
*
|
1474 |
}
|
1475 |
|
1476 |
// Check if other plugins have registered this same slug.
|
1477 |
+
$public = get_taxonomies( array( '_builtin' => false, 'public' => true ) );
|
1478 |
+
$private = get_taxonomies( array( '_builtin' => false, 'public' => false ) );
|
1479 |
+
$registered_taxonomies = array_merge( $public, $private );
|
1480 |
if ( in_array( $taxonomy_slug, $registered_taxonomies ) ) {
|
1481 |
return true;
|
1482 |
}
|
1493 |
*/
|
1494 |
function cptui_process_taxonomy() {
|
1495 |
|
1496 |
+
if ( wp_doing_ajax() ) {
|
1497 |
return;
|
1498 |
}
|
1499 |
|
1515 |
$result = cptui_delete_taxonomy( $_POST );
|
1516 |
add_filter( 'cptui_taxonomy_deleted', '__return_true' );
|
1517 |
}
|
1518 |
+
|
1519 |
+
// @TODO Utilize anonymous function to admin_notice `$result` if it happens to error.
|
1520 |
if ( $result ) {
|
1521 |
+
if ( is_callable( "cptui_{$result}_admin_notice" ) ) {
|
1522 |
+
add_action( 'admin_notices', "cptui_{$result}_admin_notice" );
|
1523 |
+
}
|
1524 |
}
|
1525 |
}
|
1526 |
}
|
1543 |
* @param bool $value Whether or not to convert.
|
1544 |
*/
|
1545 |
if ( apply_filters( 'cptui_convert_taxonomy_terms', false ) ) {
|
1546 |
+
check_admin_referer( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
|
1547 |
+
|
1548 |
cptui_convert_taxonomy_terms( sanitize_text_field( $_POST['tax_original'] ), sanitize_text_field( $_POST['cpt_custom_tax']['name'] ) );
|
1549 |
}
|
1550 |
}
|
inc/tools.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage Tools
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -13,6 +14,26 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
exit;
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Register our tabs for the Tools screen.
|
18 |
*
|
@@ -135,7 +156,7 @@ function cptui_tools() {
|
|
135 |
do_action( 'cptui_inside_tools_wrap' );
|
136 |
|
137 |
// Create our tabs.
|
138 |
-
cptui_settings_tab_menu(
|
139 |
|
140 |
/**
|
141 |
* Fires inside the markup for the import/export section.
|
@@ -161,7 +182,6 @@ function cptui_tools() {
|
|
161 |
*/
|
162 |
do_action( 'cptui_tools_sections', $tab );
|
163 |
|
164 |
-
|
165 |
echo '</div><!-- End .wrap -->';
|
166 |
}
|
167 |
|
@@ -185,15 +205,14 @@ function cptui_get_taxonomy_code( $cptui_taxonomies = array(), $single = false )
|
|
185 |
?>
|
186 |
function <?php echo $callback; ?>() {
|
187 |
<?php
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
}
|
192 |
-
|
193 |
add_action( 'init', '<?php echo $callback; ?>' );
|
194 |
<?php
|
195 |
} else {
|
196 |
-
|
197 |
}
|
198 |
}
|
199 |
|
@@ -240,7 +259,8 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
|
|
240 |
} else {
|
241 |
$rewrite = disp_boolean( $taxonomy['rewrite'] );
|
242 |
}
|
243 |
-
$public
|
|
|
244 |
$show_in_quick_edit = ( isset( $taxonomy['show_in_quick_edit'] ) ) ? disp_boolean( $taxonomy['show_in_quick_edit'] ) : disp_boolean( $taxonomy['show_ui'] );
|
245 |
|
246 |
$show_in_menu = ( ! empty( $taxonomy['show_in_menu'] ) && false !== get_disp_boolean( $taxonomy['show_in_menu'] ) ) ? 'true' : 'false';
|
@@ -253,26 +273,31 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
|
|
253 |
$show_in_nav_menus = $public;
|
254 |
}
|
255 |
|
256 |
-
$show_in_rest
|
257 |
-
$rest_base
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
$my_theme = wp_get_theme();
|
260 |
$textdomain = $my_theme->get( 'TextDomain' );
|
261 |
?>
|
262 |
|
263 |
/**
|
264 |
-
* Taxonomy: <?php echo $taxonomy['label']; ?>.
|
265 |
*/
|
266 |
|
267 |
$labels = array(
|
268 |
-
"name" => __( "<?php echo $taxonomy['label']; ?>", "<?php echo $textdomain; ?>" ),
|
269 |
-
"singular_name" => __( "<?php echo $taxonomy['singular_label']; ?>", "<?php echo $textdomain; ?>" ),
|
270 |
<?php
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
}
|
275 |
}
|
|
|
276 |
?>
|
277 |
);
|
278 |
|
@@ -280,8 +305,8 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
|
|
280 |
"label" => __( "<?php echo $taxonomy['label']; ?>", "<?php echo $textdomain; ?>" ),
|
281 |
"labels" => $labels,
|
282 |
"public" => <?php echo $public; ?>,
|
|
|
283 |
"hierarchical" => <?php echo $taxonomy['hierarchical']; ?>,
|
284 |
-
"label" => "<?php echo $taxonomy['label']; ?>",
|
285 |
"show_ui" => <?php echo disp_boolean( $taxonomy['show_ui'] ); ?>,
|
286 |
"show_in_menu" => <?php echo $show_in_menu; ?>,
|
287 |
"show_in_nav_menus" => <?php echo $show_in_nav_menus; ?>,
|
@@ -290,7 +315,11 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
|
|
290 |
"show_admin_column" => <?php echo $taxonomy['show_admin_column']; ?>,
|
291 |
"show_in_rest" => <?php echo $show_in_rest; ?>,
|
292 |
"rest_base" => "<?php echo $rest_base; ?>",
|
|
|
293 |
"show_in_quick_edit" => <?php echo $show_in_quick_edit; ?>,
|
|
|
|
|
|
|
294 |
);
|
295 |
register_taxonomy( "<?php echo $taxonomy['name']; ?>", <?php echo $post_types; ?>, $args );
|
296 |
<?php
|
@@ -327,7 +356,7 @@ function <?php echo $callback; ?>() {
|
|
327 |
add_action( 'init', '<?php echo $callback; ?>' );
|
328 |
<?php
|
329 |
} else {
|
330 |
-
|
331 |
}
|
332 |
}
|
333 |
|
@@ -421,6 +450,9 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
|
|
421 |
if ( empty( $post_type['show_in_rest'] ) ) {
|
422 |
$post_type['show_in_rest'] = 'false';
|
423 |
}
|
|
|
|
|
|
|
424 |
|
425 |
$show_in_menu = get_disp_boolean( $post_type['show_in_menu'] );
|
426 |
if ( false !== $show_in_menu ) {
|
@@ -438,6 +470,18 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
|
|
438 |
$show_in_nav_menus = $public;
|
439 |
}
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
$post_type['description'] = addslashes( $post_type['description'] );
|
442 |
|
443 |
$my_theme = wp_get_theme();
|
@@ -472,13 +516,15 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
|
|
472 |
"public" => <?php echo disp_boolean( $post_type['public'] ); ?>,
|
473 |
"publicly_queryable" => <?php echo disp_boolean( $post_type['publicly_queryable'] ); ?>,
|
474 |
"show_ui" => <?php echo disp_boolean( $post_type['show_ui'] ); ?>,
|
|
|
475 |
"show_in_rest" => <?php echo disp_boolean( $post_type['show_in_rest'] ); ?>,
|
476 |
"rest_base" => "<?php echo $post_type['rest_base']; ?>",
|
|
|
477 |
"has_archive" => <?php echo $has_archive; ?>,
|
478 |
"show_in_menu" => <?php echo $show_in_menu; ?>,
|
479 |
"show_in_nav_menus" => <?php echo $show_in_nav_menus; ?>,
|
480 |
"exclude_from_search" => <?php echo disp_boolean( $post_type['exclude_from_search'] ); ?>,
|
481 |
-
"capability_type" =>
|
482 |
"map_meta_cap" => <?php echo disp_boolean( $post_type['map_meta_cap'] ); ?>,
|
483 |
"hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
|
484 |
"rewrite" => <?php echo $rewrite; ?>,
|
@@ -659,32 +705,32 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
|
|
659 |
function cptui_render_posttypes_taxonomies_section() {
|
660 |
?>
|
661 |
|
662 |
-
<p><?php
|
663 |
|
664 |
<p>
|
665 |
<?php
|
666 |
printf(
|
667 |
'<strong>%s</strong>: %s',
|
668 |
-
|
669 |
-
|
670 |
);
|
671 |
?>
|
672 |
</p>
|
673 |
<table class="form-table cptui-table">
|
674 |
<?php if ( ! empty( $_GET ) && empty( $_GET['action'] ) ) { ?>
|
675 |
<tr>
|
676 |
-
<td class="
|
677 |
-
<h2><label for="cptui_post_import"><?php
|
678 |
|
679 |
<form method="post">
|
680 |
<textarea class="cptui_post_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'custom-post-type-ui' ); ?>" id="cptui_post_import" name="cptui_post_import"></textarea>
|
681 |
|
682 |
<p class="wp-ui-highlight">
|
683 |
-
<strong><?php
|
684 |
</p>
|
685 |
|
686 |
<p>
|
687 |
-
<strong><?php
|
688 |
</p>
|
689 |
|
690 |
<p>
|
@@ -692,37 +738,37 @@ function cptui_render_posttypes_taxonomies_section() {
|
|
692 |
</p>
|
693 |
</form>
|
694 |
</td>
|
695 |
-
<td class="
|
696 |
-
<h2><label for="cptui_post_export"><?php
|
697 |
<?php
|
698 |
$cptui_post_types = cptui_get_post_type_data();
|
699 |
if ( ! empty( $cptui_post_types ) ) {
|
700 |
$content = esc_html( json_encode( $cptui_post_types ) );
|
701 |
} else {
|
702 |
-
$content =
|
703 |
}
|
704 |
?>
|
705 |
-
<textarea title="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'custom-post-type-ui' ); ?>" onclick="this.focus();this.select();" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true" class="cptui_post_import" id="cptui_post_export" name="cptui_post_export"><?php echo $content; ?></textarea>
|
706 |
|
707 |
<p>
|
708 |
-
<strong><?php
|
709 |
</p>
|
710 |
</td>
|
711 |
</tr>
|
712 |
<?php } elseif ( ! empty( $_GET ) && 'taxonomies' == $_GET['action'] ) { ?>
|
713 |
<tr>
|
714 |
-
<td class="
|
715 |
-
<h2><label for="cptui_tax_import"><?php
|
716 |
|
717 |
<form method="post">
|
718 |
<textarea class="cptui_tax_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'custom-post-type-ui' ); ?>" id="cptui_tax_import" name="cptui_tax_import"></textarea>
|
719 |
|
720 |
<p class="wp-ui-highlight">
|
721 |
-
<strong><?php
|
722 |
</p>
|
723 |
|
724 |
<p>
|
725 |
-
<strong><?php
|
726 |
</p>
|
727 |
|
728 |
<p>
|
@@ -730,20 +776,20 @@ function cptui_render_posttypes_taxonomies_section() {
|
|
730 |
</p>
|
731 |
</form>
|
732 |
</td>
|
733 |
-
<td class="
|
734 |
-
<h2><label for="cptui_tax_export"><?php
|
735 |
<?php
|
736 |
$cptui_taxonomies = cptui_get_taxonomy_data();
|
737 |
if ( ! empty( $cptui_taxonomies ) ) {
|
738 |
$content = esc_html( json_encode( $cptui_taxonomies ) );
|
739 |
} else {
|
740 |
-
$content =
|
741 |
}
|
742 |
?>
|
743 |
-
<textarea title="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'custom-post-type-ui' ); ?>" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true" class="cptui_tax_import" id="cptui_tax_export" name="cptui_tax_export"><?php echo $content;
|
744 |
|
745 |
<p>
|
746 |
-
<strong><?php
|
747 |
</p>
|
748 |
</td>
|
749 |
</tr>
|
@@ -761,14 +807,14 @@ function cptui_render_posttypes_taxonomies_section() {
|
|
761 |
*/
|
762 |
function cptui_render_getcode_section() {
|
763 |
?>
|
764 |
-
<h1><?php
|
765 |
|
766 |
-
<h2><?php
|
767 |
|
768 |
-
<p><?php esc_html_e( 'All of the selectable code snippets below are useful if you wish to migrate away from
|
769 |
|
770 |
<?php $cptui_post_types = cptui_get_post_type_data(); ?>
|
771 |
-
<label for="cptui_post_type_get_code"><?php
|
772 |
<textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea>
|
773 |
|
774 |
<?php
|
@@ -776,16 +822,16 @@ function cptui_render_getcode_section() {
|
|
776 |
foreach ( $cptui_post_types as $post_type ) { ?>
|
777 |
<h2 id="<?php echo esc_attr( $post_type['name'] ); ?>"><?php
|
778 |
$type = ( ! empty( $post_type['label'] ) ) ? $post_type['label'] : $post_type['name'];
|
779 |
-
printf(
|
780 |
-
<label for="cptui_post_type_get_code_<?php echo $post_type['name']; ?>"><?php
|
781 |
-
<textarea name="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" id="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( array( $post_type ), true ); ?></textarea>
|
782 |
<?php }
|
783 |
} ?>
|
784 |
|
785 |
-
<h2><?php
|
786 |
|
787 |
<?php $cptui_taxonomies = cptui_get_taxonomy_data(); ?>
|
788 |
-
<label for="cptui_tax_get_code"><?php
|
789 |
<textarea name="cptui_tax_get_code" id="cptui_tax_get_code" class="cptui_tax_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_taxonomy_code( $cptui_taxonomies ); ?></textarea>
|
790 |
|
791 |
<?php
|
@@ -793,9 +839,9 @@ function cptui_render_getcode_section() {
|
|
793 |
foreach ( $cptui_taxonomies as $taxonomy ) { ?>
|
794 |
<h2 id="<?php echo esc_attr( $taxonomy['name'] ); ?>"><?php
|
795 |
$tax = ( ! empty( $taxonomy['label'] ) ) ? $taxonomy['label'] : $taxonomy['name'];
|
796 |
-
printf(
|
797 |
-
<label for="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>"><?php
|
798 |
-
<textarea name="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>" id="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>" class="cptui_tax_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_taxonomy_code( array( $taxonomy ), true ); ?></textarea>
|
799 |
<?php }
|
800 |
} ?>
|
801 |
<?php
|
@@ -809,18 +855,23 @@ function cptui_render_getcode_section() {
|
|
809 |
* @internal
|
810 |
*/
|
811 |
function cptui_render_debuginfo_section() {
|
|
|
812 |
$debuginfo = new CPTUI_Debug_Info();
|
813 |
|
814 |
echo '<form id="cptui_debug_info" method="post">';
|
815 |
$debuginfo->tab_site_info();
|
816 |
|
817 |
-
|
|
|
|
|
|
|
|
|
818 |
$email_args = array();
|
819 |
$email_args['email'] = sanitize_text_field( $_POST['cptui_debug_info_email'] );
|
820 |
$debuginfo->send_email( $email_args );
|
821 |
}
|
822 |
|
823 |
-
echo '<p><label for="cptui_debug_info_email">' .
|
824 |
|
825 |
/**
|
826 |
* Filters the text value to use on the button when sending debug information.
|
6 |
* @subpackage Tools
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.0.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
+
/**
|
18 |
+
* Enqueue our Custom Post Type UI assets.
|
19 |
+
*
|
20 |
+
* @since 1.6.0
|
21 |
+
*/
|
22 |
+
function cptui_tools_assets() {
|
23 |
+
$current_screen = get_current_screen();
|
24 |
+
|
25 |
+
if ( ! is_object( $current_screen ) || 'cpt-ui_page_cptui_tools' !== $current_screen->base ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( wp_doing_ajax() ) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
wp_enqueue_style( 'cptui-css' );
|
34 |
+
}
|
35 |
+
add_action( 'admin_enqueue_scripts', 'cptui_tools_assets' );
|
36 |
+
|
37 |
/**
|
38 |
* Register our tabs for the Tools screen.
|
39 |
*
|
156 |
do_action( 'cptui_inside_tools_wrap' );
|
157 |
|
158 |
// Create our tabs.
|
159 |
+
cptui_settings_tab_menu( 'tools' );
|
160 |
|
161 |
/**
|
162 |
* Fires inside the markup for the import/export section.
|
182 |
*/
|
183 |
do_action( 'cptui_tools_sections', $tab );
|
184 |
|
|
|
185 |
echo '</div><!-- End .wrap -->';
|
186 |
}
|
187 |
|
205 |
?>
|
206 |
function <?php echo $callback; ?>() {
|
207 |
<?php
|
208 |
+
foreach ( $cptui_taxonomies as $tax ) {
|
209 |
+
echo cptui_get_single_taxonomy_registery( $tax );
|
210 |
+
} ?>
|
211 |
}
|
|
|
212 |
add_action( 'init', '<?php echo $callback; ?>' );
|
213 |
<?php
|
214 |
} else {
|
215 |
+
esc_html_e( 'No taxonomies to display at this time', 'custom-post-type-ui' );
|
216 |
}
|
217 |
}
|
218 |
|
259 |
} else {
|
260 |
$rewrite = disp_boolean( $taxonomy['rewrite'] );
|
261 |
}
|
262 |
+
$public = ( isset( $taxonomy['public'] ) ) ? disp_boolean( $taxonomy['public'] ) : 'true';
|
263 |
+
$publicly_queryable = ( isset( $taxonomy['publicly_queryable'] ) ) ? disp_boolean( $taxonomy['publicly_queryable'] ) : disp_boolean( $taxonomy['public'] );
|
264 |
$show_in_quick_edit = ( isset( $taxonomy['show_in_quick_edit'] ) ) ? disp_boolean( $taxonomy['show_in_quick_edit'] ) : disp_boolean( $taxonomy['show_ui'] );
|
265 |
|
266 |
$show_in_menu = ( ! empty( $taxonomy['show_in_menu'] ) && false !== get_disp_boolean( $taxonomy['show_in_menu'] ) ) ? 'true' : 'false';
|
273 |
$show_in_nav_menus = $public;
|
274 |
}
|
275 |
|
276 |
+
$show_in_rest = ( ! empty( $taxonomy['show_in_rest'] ) && false !== get_disp_boolean( $taxonomy['show_in_rest'] ) ) ? 'true' : 'false';
|
277 |
+
$rest_base = ( ! empty( $taxonomy['rest_base'] ) ) ? $taxonomy['rest_base'] : $taxonomy['name'];
|
278 |
+
$rest_controller_class = ( ! empty( $taxonomy['rest_controller_class'] ) ) ? $taxonomy['rest_controller_class'] : 'WP_REST_Terms_Controller';
|
279 |
+
|
280 |
+
if ( ! empty( $taxonomy['meta_box_cb'] ) ) {
|
281 |
+
$meta_box_cb = ( false !== get_disp_boolean( $taxonomy['meta_box_cb'] ) ) ? '"' . $taxonomy['meta_box_cb'] . '"' : 'false';
|
282 |
+
}
|
283 |
|
284 |
$my_theme = wp_get_theme();
|
285 |
$textdomain = $my_theme->get( 'TextDomain' );
|
286 |
?>
|
287 |
|
288 |
/**
|
289 |
+
* Taxonomy: <?php echo esc_html( $taxonomy['label'] ); ?>.
|
290 |
*/
|
291 |
|
292 |
$labels = array(
|
293 |
+
"name" => __( "<?php echo esc_html( $taxonomy['label'] ); ?>", "<?php echo esc_html( $textdomain ); ?>" ),
|
294 |
+
"singular_name" => __( "<?php echo esc_html( $taxonomy['singular_label'] ); ?>", "<?php echo esc_html( $textdomain ); ?>" ),
|
295 |
<?php
|
296 |
+
foreach ( $taxonomy['labels'] as $key => $label ) {
|
297 |
+
if ( ! empty( $label ) ) {
|
298 |
+
echo "\t\t" . '"' . esc_html( $key ) . '" => __( "' . esc_html( $label ) . '", "' . esc_html( $textdomain ) . '" ),' . "\n";
|
|
|
299 |
}
|
300 |
+
}
|
301 |
?>
|
302 |
);
|
303 |
|
305 |
"label" => __( "<?php echo $taxonomy['label']; ?>", "<?php echo $textdomain; ?>" ),
|
306 |
"labels" => $labels,
|
307 |
"public" => <?php echo $public; ?>,
|
308 |
+
"publicly_queryable => <?php echo $publicly_queryable; ?>,
|
309 |
"hierarchical" => <?php echo $taxonomy['hierarchical']; ?>,
|
|
|
310 |
"show_ui" => <?php echo disp_boolean( $taxonomy['show_ui'] ); ?>,
|
311 |
"show_in_menu" => <?php echo $show_in_menu; ?>,
|
312 |
"show_in_nav_menus" => <?php echo $show_in_nav_menus; ?>,
|
315 |
"show_admin_column" => <?php echo $taxonomy['show_admin_column']; ?>,
|
316 |
"show_in_rest" => <?php echo $show_in_rest; ?>,
|
317 |
"rest_base" => "<?php echo $rest_base; ?>",
|
318 |
+
"rest_controller_class" => "<?php echo $rest_controller_class; ?>",
|
319 |
"show_in_quick_edit" => <?php echo $show_in_quick_edit; ?>,
|
320 |
+
<?php if ( ! empty( $meta_box_cb ) ) { ?>
|
321 |
+
"meta_box_cb" => <?php echo $meta_box_cb; ?>,
|
322 |
+
<?php } ?>
|
323 |
);
|
324 |
register_taxonomy( "<?php echo $taxonomy['name']; ?>", <?php echo $post_types; ?>, $args );
|
325 |
<?php
|
356 |
add_action( 'init', '<?php echo $callback; ?>' );
|
357 |
<?php
|
358 |
} else {
|
359 |
+
esc_html_e( 'No post types to display at this time', 'custom-post-type-ui' );
|
360 |
}
|
361 |
}
|
362 |
|
450 |
if ( empty( $post_type['show_in_rest'] ) ) {
|
451 |
$post_type['show_in_rest'] = 'false';
|
452 |
}
|
453 |
+
$rest_controller_class = ( ! empty( $post_type['rest_controller_class'] ) ) ? $post_type['rest_controller_class'] : 'WP_REST_Posts_Controller';
|
454 |
+
|
455 |
+
$delete_with_user = ( ! empty( $post_type['delete_with_user'] ) && false !== get_disp_boolean( $post_type['delete_with_user'] ) ) ? 'true' : 'false';
|
456 |
|
457 |
$show_in_menu = get_disp_boolean( $post_type['show_in_menu'] );
|
458 |
if ( false !== $show_in_menu ) {
|
470 |
$show_in_nav_menus = $public;
|
471 |
}
|
472 |
|
473 |
+
$capability_type = '"post"';
|
474 |
+
if ( ! empty( $post_type['capability_type'] ) ) {
|
475 |
+
$capability_type = '"' . $post_type['capability_type'] . '"';
|
476 |
+
if ( false !== strpos( $post_type['capability_type'], ',' ) ) {
|
477 |
+
$caps = array_map( 'trim', explode( ',', $post_type['capability_type'] ) );
|
478 |
+
if ( count( $caps ) > 2 ) {
|
479 |
+
$caps = array_slice( $caps, 0, 2 );
|
480 |
+
}
|
481 |
+
$capability_type = 'array( "' . $caps[0] . '", "' . $caps[1] . '" )';
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
$post_type['description'] = addslashes( $post_type['description'] );
|
486 |
|
487 |
$my_theme = wp_get_theme();
|
516 |
"public" => <?php echo disp_boolean( $post_type['public'] ); ?>,
|
517 |
"publicly_queryable" => <?php echo disp_boolean( $post_type['publicly_queryable'] ); ?>,
|
518 |
"show_ui" => <?php echo disp_boolean( $post_type['show_ui'] ); ?>,
|
519 |
+
"delete_with_user" => <?php echo $delete_with_user; ?>,
|
520 |
"show_in_rest" => <?php echo disp_boolean( $post_type['show_in_rest'] ); ?>,
|
521 |
"rest_base" => "<?php echo $post_type['rest_base']; ?>",
|
522 |
+
"rest_controller_class" => "<?php echo $rest_controller_class; ?>",
|
523 |
"has_archive" => <?php echo $has_archive; ?>,
|
524 |
"show_in_menu" => <?php echo $show_in_menu; ?>,
|
525 |
"show_in_nav_menus" => <?php echo $show_in_nav_menus; ?>,
|
526 |
"exclude_from_search" => <?php echo disp_boolean( $post_type['exclude_from_search'] ); ?>,
|
527 |
+
"capability_type" => <?php echo $capability_type; ?>,
|
528 |
"map_meta_cap" => <?php echo disp_boolean( $post_type['map_meta_cap'] ); ?>,
|
529 |
"hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
|
530 |
"rewrite" => <?php echo $rewrite; ?>,
|
705 |
function cptui_render_posttypes_taxonomies_section() {
|
706 |
?>
|
707 |
|
708 |
+
<p><?php esc_html_e( 'If you are wanting to migrate registered post types or taxonomies from this site to another, that will also use Custom Post Type UI, use the import and export functionality. If you are moving away from Custom Post Type UI, use the information in the "Get Code" tab.', 'custom-post-type-ui' ); ?></p>
|
709 |
|
710 |
<p>
|
711 |
<?php
|
712 |
printf(
|
713 |
'<strong>%s</strong>: %s',
|
714 |
+
esc_html__( 'NOTE', 'custom-post-type-ui' ),
|
715 |
+
esc_html__( 'This will not export the associated posts or taxonomy terms, just the settings.', 'custom-post-type-ui' )
|
716 |
);
|
717 |
?>
|
718 |
</p>
|
719 |
<table class="form-table cptui-table">
|
720 |
<?php if ( ! empty( $_GET ) && empty( $_GET['action'] ) ) { ?>
|
721 |
<tr>
|
722 |
+
<td class="outer">
|
723 |
+
<h2><label for="cptui_post_import"><?php esc_html_e( 'Import Post Types', 'custom-post-type-ui' ); ?></label></h2>
|
724 |
|
725 |
<form method="post">
|
726 |
<textarea class="cptui_post_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'custom-post-type-ui' ); ?>" id="cptui_post_import" name="cptui_post_import"></textarea>
|
727 |
|
728 |
<p class="wp-ui-highlight">
|
729 |
+
<strong><?php esc_html_e( 'Note:', 'custom-post-type-ui' ); ?></strong> <?php esc_html_e( 'Importing will overwrite previous registered settings.', 'custom-post-type-ui' ); ?>
|
730 |
</p>
|
731 |
|
732 |
<p>
|
733 |
+
<strong><?php esc_html_e( 'To import post types from a different WordPress site, paste the exported content from that site and click the "Import" button.', 'custom-post-type-ui' ); ?></strong>
|
734 |
</p>
|
735 |
|
736 |
<p>
|
738 |
</p>
|
739 |
</form>
|
740 |
</td>
|
741 |
+
<td class="outer">
|
742 |
+
<h2><label for="cptui_post_export"><?php esc_html_e( 'Export Post Types settings', 'custom-post-type-ui' ); ?></label></h2>
|
743 |
<?php
|
744 |
$cptui_post_types = cptui_get_post_type_data();
|
745 |
if ( ! empty( $cptui_post_types ) ) {
|
746 |
$content = esc_html( json_encode( $cptui_post_types ) );
|
747 |
} else {
|
748 |
+
$content = esc_html__( 'No post types registered yet.', 'custom-post-type-ui' );
|
749 |
}
|
750 |
?>
|
751 |
+
<textarea title="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'custom-post-type-ui' ); ?>" onclick="this.focus();this.select();" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true" class="cptui_post_import" id="cptui_post_export" name="cptui_post_export"><?php echo $content; // WPCS: XSS ok, sanitization ok. ?></textarea>
|
752 |
|
753 |
<p>
|
754 |
+
<strong><?php esc_html_e( 'Use the content above to import current post types into a different WordPress site. You can also use this to simply back up your post type settings.', 'custom-post-type-ui' ); ?></strong>
|
755 |
</p>
|
756 |
</td>
|
757 |
</tr>
|
758 |
<?php } elseif ( ! empty( $_GET ) && 'taxonomies' == $_GET['action'] ) { ?>
|
759 |
<tr>
|
760 |
+
<td class="outer">
|
761 |
+
<h2><label for="cptui_tax_import"><?php esc_html_e( 'Import Taxonomies', 'custom-post-type-ui' ); ?></label></h2>
|
762 |
|
763 |
<form method="post">
|
764 |
<textarea class="cptui_tax_import" placeholder="<?php esc_attr_e( 'Paste content here.', 'custom-post-type-ui' ); ?>" id="cptui_tax_import" name="cptui_tax_import"></textarea>
|
765 |
|
766 |
<p class="wp-ui-highlight">
|
767 |
+
<strong><?php esc_html_e( 'Note:', 'custom-post-type-ui' ); ?></strong> <?php esc_html_e( 'Importing will overwrite previous registered settings.', 'custom-post-type-ui' ); ?>
|
768 |
</p>
|
769 |
|
770 |
<p>
|
771 |
+
<strong><?php esc_html_e( 'To import taxonomies from a different WordPress site, paste the exported content from that site and click the "Import" button.', 'custom-post-type-ui' ); ?></strong>
|
772 |
</p>
|
773 |
|
774 |
<p>
|
776 |
</p>
|
777 |
</form>
|
778 |
</td>
|
779 |
+
<td class="outer">
|
780 |
+
<h2><label for="cptui_tax_export"><?php esc_html_e( 'Export Taxonomies settings', 'custom-post-type-ui' ); ?></label></h2>
|
781 |
<?php
|
782 |
$cptui_taxonomies = cptui_get_taxonomy_data();
|
783 |
if ( ! empty( $cptui_taxonomies ) ) {
|
784 |
$content = esc_html( json_encode( $cptui_taxonomies ) );
|
785 |
} else {
|
786 |
+
$content = esc_html__( 'No taxonomies registered yet.', 'custom-post-type-ui' );
|
787 |
}
|
788 |
?>
|
789 |
+
<textarea title="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'custom-post-type-ui' ); ?>" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true" class="cptui_tax_import" id="cptui_tax_export" name="cptui_tax_export"><?php echo $content; //WPCS: XSS ok, sanitization ok.?></textarea>
|
790 |
|
791 |
<p>
|
792 |
+
<strong><?php esc_html_e( 'Use the content above to import current taxonomies into a different WordPress site. You can also use this to simply back up your taxonomy settings.', 'custom-post-type-ui' ); ?></strong>
|
793 |
</p>
|
794 |
</td>
|
795 |
</tr>
|
807 |
*/
|
808 |
function cptui_render_getcode_section() {
|
809 |
?>
|
810 |
+
<h1><?php esc_html_e( 'Get Post Type and Taxonomy Code', 'custom-post-type-ui' ); ?></h1>
|
811 |
|
812 |
+
<h2><?php esc_html_e( 'All Custom Post Type UI Post Types', 'custom-post-type-ui' ); ?></h2>
|
813 |
|
814 |
+
<p><?php esc_html_e( 'All of the selectable code snippets below are useful if you wish to migrate away from Custom Post Type UI and retain your existing registered post types or taxonomies.', 'custom-post-type-ui' ); ?></p>
|
815 |
|
816 |
<?php $cptui_post_types = cptui_get_post_type_data(); ?>
|
817 |
+
<label for="cptui_post_type_get_code"><?php esc_html_e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
|
818 |
<textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea>
|
819 |
|
820 |
<?php
|
822 |
foreach ( $cptui_post_types as $post_type ) { ?>
|
823 |
<h2 id="<?php echo esc_attr( $post_type['name'] ); ?>"><?php
|
824 |
$type = ( ! empty( $post_type['label'] ) ) ? $post_type['label'] : $post_type['name'];
|
825 |
+
printf( esc_html__( '%s Post Type', 'custom-post-type-ui' ), esc_html( $type ) ); ?></h2>
|
826 |
+
<label for="cptui_post_type_get_code_<?php echo esc_attr( $post_type['name'] ); ?>"><?php esc_html_e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
|
827 |
+
<textarea name="cptui_post_type_get_code_<?php echo esc_attr( $post_type['name'] ); ?>" id="cptui_post_type_get_code_<?php echo esc_attr( $post_type['name'] ); ?>" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( array( $post_type ), true ); ?></textarea>
|
828 |
<?php }
|
829 |
} ?>
|
830 |
|
831 |
+
<h2><?php esc_html_e( 'All Custom Post Type UI Taxonomies', 'custom-post-type-ui' ); ?></h2>
|
832 |
|
833 |
<?php $cptui_taxonomies = cptui_get_taxonomy_data(); ?>
|
834 |
+
<label for="cptui_tax_get_code"><?php esc_html_e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
|
835 |
<textarea name="cptui_tax_get_code" id="cptui_tax_get_code" class="cptui_tax_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_taxonomy_code( $cptui_taxonomies ); ?></textarea>
|
836 |
|
837 |
<?php
|
839 |
foreach ( $cptui_taxonomies as $taxonomy ) { ?>
|
840 |
<h2 id="<?php echo esc_attr( $taxonomy['name'] ); ?>"><?php
|
841 |
$tax = ( ! empty( $taxonomy['label'] ) ) ? $taxonomy['label'] : $taxonomy['name'];
|
842 |
+
printf( esc_html__( '%s Taxonomy', 'custom-post-type-ui' ), esc_html( $tax ) ); ?></h2>
|
843 |
+
<label for="cptui_tax_get_code_<?php echo esc_attr( $taxonomy['name'] ); ?>"><?php esc_html_e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
|
844 |
+
<textarea name="cptui_tax_get_code_<?php echo esc_attr( $taxonomy['name'] ); ?>" id="cptui_tax_get_code_<?php echo esc_attr( $taxonomy['name'] ); ?>" class="cptui_tax_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_taxonomy_code( array( $taxonomy ), true ); ?></textarea>
|
845 |
<?php }
|
846 |
} ?>
|
847 |
<?php
|
855 |
* @internal
|
856 |
*/
|
857 |
function cptui_render_debuginfo_section() {
|
858 |
+
|
859 |
$debuginfo = new CPTUI_Debug_Info();
|
860 |
|
861 |
echo '<form id="cptui_debug_info" method="post">';
|
862 |
$debuginfo->tab_site_info();
|
863 |
|
864 |
+
wp_nonce_field( 'cptui_debuginfo_nonce_action', 'cptui_debuginfo_nonce_field' );
|
865 |
+
|
866 |
+
if ( ! empty( $_POST ) && isset( $_POST['cptui_debug_info_email'] ) && isset( $_POST['cptui_debuginfo_nonce_field'] ) ) {
|
867 |
+
wp_verify_nonce( 'cptui_debuginfo_nonce_field', 'cptui_debuginfo_nonce_action' );
|
868 |
+
|
869 |
$email_args = array();
|
870 |
$email_args['email'] = sanitize_text_field( $_POST['cptui_debug_info_email'] );
|
871 |
$debuginfo->send_email( $email_args );
|
872 |
}
|
873 |
|
874 |
+
echo '<p><label for="cptui_debug_info_email">' . esc_html__( 'Please provide an email address to send debug information to: ', 'custom-post-type-ui' ) . '</label><input type="email" id="cptui_debug_info_email" name="cptui_debug_info_email" value="" /></p>';
|
875 |
|
876 |
/**
|
877 |
* Filters the text value to use on the button when sending debug information.
|
inc/utility.php
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
* @subpackage Utility
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.3.0
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
@@ -111,6 +112,18 @@ function cptui_footer( $original = '' ) {
|
|
111 |
'<a href="http://wordpress.org/support/plugin/custom-post-type-ui" target="_blank">%s</a>',
|
112 |
__( 'Support forums', 'custom-post-type-ui' )
|
113 |
) . ' - ' .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
__( 'Follow on Twitter:', 'custom-post-type-ui' ) .
|
115 |
sprintf(
|
116 |
' %s',
|
@@ -126,7 +139,7 @@ add_filter( 'admin_footer_text', 'cptui_footer' );
|
|
126 |
*/
|
127 |
function cptui_flush_rewrite_rules() {
|
128 |
|
129 |
-
if (
|
130 |
return;
|
131 |
}
|
132 |
|
@@ -233,7 +246,7 @@ function cptui_get_post_form_action( $ui = '' ) {
|
|
233 |
* @param object $ui CPTUI Admin UI instance.
|
234 |
*/
|
235 |
function cptui_post_form_action( $ui ) {
|
236 |
-
echo cptui_get_post_form_action( $ui );
|
237 |
}
|
238 |
|
239 |
/**
|
@@ -280,6 +293,29 @@ function cptui_get_post_type_exists( $slug = '', $data = array() ) {
|
|
280 |
return apply_filters( 'cptui_get_post_type_exists', post_type_exists( $slug ), $data );
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
/**
|
284 |
* Displays WebDevStudios products in a sidebar on the add/edit screens for post types and taxonomies.
|
285 |
*
|
@@ -332,7 +368,6 @@ add_action( 'cptui_below_taxonomy_tab_menu', 'cptui_products_sidebar' );
|
|
332 |
function cptui_newsletter_form() {
|
333 |
?>
|
334 |
<!-- Begin MailChimp Signup Form -->
|
335 |
-
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
|
336 |
<div id="mc_embed_signup">
|
337 |
<form action="//webdevstudios.us1.list-manage.com/subscribe/post?u=67169b098c99de702c897d63e&id=9cb1c7472e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
|
338 |
<div id="mc_embed_signup_scroll">
|
@@ -353,18 +388,38 @@ function cptui_newsletter_form() {
|
|
353 |
</div>
|
354 |
</form>
|
355 |
</div>
|
356 |
-
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script>
|
357 |
-
<script type='text/javascript'>(function ($) {
|
358 |
-
window.fnames = new Array();
|
359 |
-
window.ftypes = new Array();
|
360 |
-
fnames[0] = 'EMAIL';
|
361 |
-
ftypes[0] = 'email';
|
362 |
-
}(jQuery));
|
363 |
-
var $mcj = jQuery.noConflict(true);</script>
|
364 |
<!--End mc_embed_signup-->
|
365 |
<?php
|
366 |
}
|
367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
/**
|
369 |
* Fetch all set ads to be displayed.
|
370 |
*
|
@@ -428,6 +483,29 @@ function cptui_default_ads( $ads = array() ) {
|
|
428 |
}
|
429 |
add_filter( 'cptui_ads', 'cptui_default_ads' );
|
430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
/**
|
432 |
* Secondary admin notices function for use with admin_notices hook.
|
433 |
*
|
@@ -437,7 +515,7 @@ add_filter( 'cptui_ads', 'cptui_default_ads' );
|
|
437 |
*
|
438 |
* @param string $message Message to use in admin notice. Optional. Default empty string.
|
439 |
* @param bool $success Whether or not a success. Optional. Default true.
|
440 |
-
* @return mixed
|
441 |
*/
|
442 |
function cptui_admin_notices_helper( $message = '', $success = true ) {
|
443 |
|
@@ -627,6 +705,17 @@ function cptui_slug_matches_taxonomy() {
|
|
627 |
);
|
628 |
}
|
629 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
/**
|
631 |
* Returns error message for if trying to register post type with matching page slug.
|
632 |
*
|
@@ -686,7 +775,7 @@ function cptui_not_new_install( $wp_upgrader, $extras ) {
|
|
686 |
}
|
687 |
|
688 |
// Was CPTUI updated?
|
689 |
-
if ( ! in_array( 'custom-post-type-ui/custom-post-type-ui.php', $extras['plugins'] ) ) {
|
690 |
return;
|
691 |
}
|
692 |
|
6 |
* @subpackage Utility
|
7 |
* @author WebDevStudios
|
8 |
* @since 1.3.0
|
9 |
+
* @license GPL-2.0+
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
112 |
'<a href="http://wordpress.org/support/plugin/custom-post-type-ui" target="_blank">%s</a>',
|
113 |
__( 'Support forums', 'custom-post-type-ui' )
|
114 |
) . ' - ' .
|
115 |
+
sprintf(
|
116 |
+
'<a href="https://wordpress.org/plugins/custom-post-type-ui/reviews/" target="_blank">%s</a>',
|
117 |
+
sprintf(
|
118 |
+
// translators: Placeholder will hold `<abbr>` tag for CPTUI.
|
119 |
+
__( 'Review %s', 'custom-post-type-ui' ),
|
120 |
+
sprintf(
|
121 |
+
'<abbr title="%s">%s</abbr>',
|
122 |
+
esc_attr__( 'Custom Post Type UI', 'custom-post-type-ui' ),
|
123 |
+
'CPTUI'
|
124 |
+
)
|
125 |
+
)
|
126 |
+
) . ' - ' .
|
127 |
__( 'Follow on Twitter:', 'custom-post-type-ui' ) .
|
128 |
sprintf(
|
129 |
' %s',
|
139 |
*/
|
140 |
function cptui_flush_rewrite_rules() {
|
141 |
|
142 |
+
if ( wp_doing_ajax() ) {
|
143 |
return;
|
144 |
}
|
145 |
|
246 |
* @param object $ui CPTUI Admin UI instance.
|
247 |
*/
|
248 |
function cptui_post_form_action( $ui ) {
|
249 |
+
echo esc_attr( cptui_get_post_form_action( $ui ) );
|
250 |
}
|
251 |
|
252 |
/**
|
293 |
return apply_filters( 'cptui_get_post_type_exists', post_type_exists( $slug ), $data );
|
294 |
}
|
295 |
|
296 |
+
/**
|
297 |
+
* Checks if a taxonomy is already registered.
|
298 |
+
*
|
299 |
+
* @since 1.6.0
|
300 |
+
*
|
301 |
+
* @param string $slug Taxonomy slug to check. Optional. Default empty string.
|
302 |
+
* @param array|string $data Taxonomy data being utilized. Optional.
|
303 |
+
*
|
304 |
+
* @return mixed
|
305 |
+
*/
|
306 |
+
function cptui_get_taxonomy_exists( $slug = '', $data = array() ) {
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Filters the boolean value for if a taxonomy exists for 3rd parties.
|
310 |
+
*
|
311 |
+
* @since 1.6.0
|
312 |
+
*
|
313 |
+
* @param string $slug Taxonomy slug to check.
|
314 |
+
* @param array|string $data Taxonomy data being utilized.
|
315 |
+
*/
|
316 |
+
return apply_filters( 'cptui_get_taxonomy_exists', taxonomy_exists( $slug ), $data );
|
317 |
+
}
|
318 |
+
|
319 |
/**
|
320 |
* Displays WebDevStudios products in a sidebar on the add/edit screens for post types and taxonomies.
|
321 |
*
|
368 |
function cptui_newsletter_form() {
|
369 |
?>
|
370 |
<!-- Begin MailChimp Signup Form -->
|
|
|
371 |
<div id="mc_embed_signup">
|
372 |
<form action="//webdevstudios.us1.list-manage.com/subscribe/post?u=67169b098c99de702c897d63e&id=9cb1c7472e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
|
373 |
<div id="mc_embed_signup_scroll">
|
388 |
</div>
|
389 |
</form>
|
390 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
<!--End mc_embed_signup-->
|
392 |
<?php
|
393 |
}
|
394 |
|
395 |
+
function cptui_mailchimp_scripts_styles() {
|
396 |
+
$current_screen = get_current_screen();
|
397 |
+
|
398 |
+
if ( ! is_object( $current_screen ) ) {
|
399 |
+
return;
|
400 |
+
}
|
401 |
+
|
402 |
+
$screens = array(
|
403 |
+
'toplevel_page_cptui_main_menu',
|
404 |
+
'cpt-ui_page_cptui_manage_post_types',
|
405 |
+
'cpt-ui_page_cptui_manage_taxonomies',
|
406 |
+
);
|
407 |
+
|
408 |
+
if ( ! in_array( $current_screen->base, $screens, true ) ) {
|
409 |
+
return;
|
410 |
+
}
|
411 |
+
|
412 |
+
if ( ! has_action( 'cptui_below_post_type_tab_menu' ) || ! has_action( 'cptui_below_taxonomy_tab_menu' ) ) {
|
413 |
+
return;
|
414 |
+
}
|
415 |
+
|
416 |
+
wp_enqueue_style( 'cptui-mailchimp', '//cdn-images.mailchimp.com/embedcode/classic-10_7.css' );
|
417 |
+
wp_enqueue_script( 'cptui-mailchimp-js', '//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js', array(), '', true );
|
418 |
+
wp_add_inline_script( 'cptui-mailchimp-js', '(function ($) {window.fnames = new Array();window.ftypes = new Array();fnames[0] = "EMAIL";ftypes[0] = "email";}(jQuery));var $mcj = jQuery.noConflict(true);' );
|
419 |
+
|
420 |
+
}
|
421 |
+
add_action( 'admin_enqueue_scripts', 'cptui_mailchimp_scripts_styles' );
|
422 |
+
|
423 |
/**
|
424 |
* Fetch all set ads to be displayed.
|
425 |
*
|
483 |
}
|
484 |
add_filter( 'cptui_ads', 'cptui_default_ads' );
|
485 |
|
486 |
+
/**
|
487 |
+
* Randomize our array order.
|
488 |
+
* Preserves CPTUI-Extended as the first index. Self promotion, yo.
|
489 |
+
*
|
490 |
+
* @since 1.3.0
|
491 |
+
*
|
492 |
+
* @param array $ads Array of ads to show.
|
493 |
+
* @return array
|
494 |
+
*/
|
495 |
+
function cptui_randomize_ads( $ads = array() ) {
|
496 |
+
$new_order = array();
|
497 |
+
foreach ( $ads as $key => $ad ) {
|
498 |
+
if ( false !== strpos( $ad['url'], 'custom-post-type-ui-extended' ) ) {
|
499 |
+
$new_order[] = $ad;
|
500 |
+
unset( $ads[ $key ] );
|
501 |
+
}
|
502 |
+
}
|
503 |
+
shuffle( $ads );
|
504 |
+
|
505 |
+
return array_merge( $new_order, $ads );
|
506 |
+
}
|
507 |
+
add_filter( 'cptui_ads', 'cptui_randomize_ads', 11 );
|
508 |
+
|
509 |
/**
|
510 |
* Secondary admin notices function for use with admin_notices hook.
|
511 |
*
|
515 |
*
|
516 |
* @param string $message Message to use in admin notice. Optional. Default empty string.
|
517 |
* @param bool $success Whether or not a success. Optional. Default true.
|
518 |
+
* @return mixed
|
519 |
*/
|
520 |
function cptui_admin_notices_helper( $message = '', $success = true ) {
|
521 |
|
705 |
);
|
706 |
}
|
707 |
|
708 |
+
/**
|
709 |
+
* Returns error message for if not providing a post type to associate taxonomy to.
|
710 |
+
*
|
711 |
+
* @since 1.6.0
|
712 |
+
*
|
713 |
+
* @return string
|
714 |
+
*/
|
715 |
+
function cptui_empty_cpt_on_taxonomy() {
|
716 |
+
return esc_html__( 'Please provide a post type to attach to.', 'custom-post-type-ui' );
|
717 |
+
}
|
718 |
+
|
719 |
/**
|
720 |
* Returns error message for if trying to register post type with matching page slug.
|
721 |
*
|
775 |
}
|
776 |
|
777 |
// Was CPTUI updated?
|
778 |
+
if ( ! in_array( 'custom-post-type-ui/custom-post-type-ui.php', $extras['plugins'], true ) ) {
|
779 |
return;
|
780 |
}
|
781 |
|
inc/wp-cli.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Imports and exports Custom Post Type UI setting data.
|
5 |
+
*/
|
6 |
+
class CPTUI_Import_JSON extends WP_CLI_Command {
|
7 |
+
|
8 |
+
public $args;
|
9 |
+
|
10 |
+
public $assoc_args;
|
11 |
+
|
12 |
+
public $type;
|
13 |
+
|
14 |
+
public $data = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Imports and parses JSON into CPTUI settings.
|
18 |
+
*
|
19 |
+
* ## Options
|
20 |
+
*
|
21 |
+
* [--type=<type>]
|
22 |
+
* : What type of import this is. Available options are `post_type` and `taxonomy`.
|
23 |
+
*
|
24 |
+
* [--data-path=<path>]
|
25 |
+
* : The server path to the file holding JSON data to import. Relative to PWD.
|
26 |
+
*/
|
27 |
+
public function import( $args, $assoc_args ) {
|
28 |
+
$this->args = $args;
|
29 |
+
$this->assoc_args = $assoc_args;
|
30 |
+
|
31 |
+
if ( ! isset( $this->assoc_args['type'] ) ) {
|
32 |
+
WP_CLI::error( __( 'Please provide whether you are importing post types or taxonomies', 'custom-post-type-ui' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! isset( $this->assoc_args['data-path'] ) ) {
|
36 |
+
WP_CLI::error( __( 'Please provide a path to the file holding your CPTUI JSON data.', 'custom-post-type-ui' ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->type = $assoc_args['type'];
|
40 |
+
|
41 |
+
$json = file_get_contents( $this->assoc_args['data-path'] );
|
42 |
+
|
43 |
+
if ( empty( $json ) ) {
|
44 |
+
WP_CLI::error( __( 'No JSON data found', 'custom-post-type-ui' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( 'post_type' === $this->type ) {
|
48 |
+
$this->data['cptui_post_import'] = $json;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( 'taxonomy' === $this->type ) {
|
52 |
+
$this->data['cptui_tax_import'] = $json;
|
53 |
+
}
|
54 |
+
|
55 |
+
$result = cptui_import_types_taxes_settings( $this->data );
|
56 |
+
|
57 |
+
if ( false === $result || 'import_fail' === $result ) {
|
58 |
+
WP_CLI::error( sprintf( __( 'An error on import occurred', 'custom-post-type-ui' ) ) );
|
59 |
+
} else {
|
60 |
+
WP_CLI::success( sprintf( __( 'Imported %s successfully', 'custom-post-type-ui' ), $this->type ) );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Export CPTUI settings to file.
|
66 |
+
*
|
67 |
+
* ## Options
|
68 |
+
*
|
69 |
+
* [--type=<type>]
|
70 |
+
* : Which settings to export. Available options are `post_type` and `taxonomy`.
|
71 |
+
*
|
72 |
+
* [--dest-path=<path>]
|
73 |
+
* : The path and file to export to. Relative to PWD.
|
74 |
+
*/
|
75 |
+
public function export( $args, $assoc_args ) {
|
76 |
+
$this->args = $args;
|
77 |
+
$this->assoc_args = $assoc_args;
|
78 |
+
|
79 |
+
if ( ! isset( $this->assoc_args['type'] ) ) {
|
80 |
+
WP_CLI::error( __( 'Please provide whether you are exporting your post types or taxonomies', 'custom-post-type-ui' ) );
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( ! isset( $this->assoc_args['dest-path'] ) ) {
|
84 |
+
WP_CLI::error( __( 'Please provide a path to export your data to.', 'custom-post-type-ui' ) );
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->type = $assoc_args['type'];
|
88 |
+
|
89 |
+
if ( 'post_type' === $this->type ) {
|
90 |
+
$content = cptui_get_post_type_data();
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( 'taxonomy' === $this->type ) {
|
94 |
+
$content = cptui_get_taxonomy_data();
|
95 |
+
}
|
96 |
+
|
97 |
+
$content = json_encode( $content );
|
98 |
+
$result = file_put_contents( $this->assoc_args['dest-path'], $content );
|
99 |
+
|
100 |
+
if ( false === $result ) {
|
101 |
+
WP_CLI::error( __( 'Error saving data.', 'custom-post-type-ui' ) );
|
102 |
+
}
|
103 |
+
|
104 |
+
WP_CLI::success( __( 'Successfully saved data to file.', 'custom-post-type-ui' ) );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
WP_CLI::add_command( 'cptui', 'CPTUI_Import_JSON' );
|
js/cptui.js
CHANGED
@@ -74,6 +74,22 @@ postboxes.add_postbox_toggles(pagenow);
|
|
74 |
$slugchanged.addClass('hidemessage');
|
75 |
}
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
});
|
78 |
|
79 |
// Replace diacritic characters with latin characters.
|
74 |
$slugchanged.addClass('hidemessage');
|
75 |
}
|
76 |
}
|
77 |
+
|
78 |
+
var $slugexists = $('#slugexists');
|
79 |
+
if ( typeof cptui_type_data != 'undefined' ) {
|
80 |
+
if (cptui_type_data.existing_post_types.hasOwnProperty(value) && value !== original_slug) {
|
81 |
+
$slugexists.removeClass('hidemessage');
|
82 |
+
} else {
|
83 |
+
$slugexists.addClass('hidemessage');
|
84 |
+
}
|
85 |
+
}
|
86 |
+
if ( typeof cptui_tax_data != 'undefined' ) {
|
87 |
+
if (cptui_tax_data.existing_taxonomies.hasOwnProperty(value) && value !== original_slug) {
|
88 |
+
$slugexists.removeClass('hidemessage');
|
89 |
+
} else {
|
90 |
+
$slugexists.addClass('hidemessage');
|
91 |
+
}
|
92 |
+
}
|
93 |
});
|
94 |
|
95 |
// Replace diacritic characters with latin characters.
|
js/cptui.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
postboxes.add_postbox_toggles(pagenow),function($){
|
1 |
+
postboxes.add_postbox_toggles(pagenow),function($){if($("#cptui_select_post_type_submit").hide(),$("#cptui_select_taxonomy_submit").hide(),"edit"===function(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var results=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)").exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}("action"))var original_slug=$("#name").val();$("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$("#cpt_submit_delete").on("click",function(){return!!confirm(cptui_type_data.confirm)}),$("#support .question").each(function(){var tis=$(this),state=!1,answer=tis.next("div").slideUp();tis.on("click keydown",function(e){"keydown"===e.type&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),state=!state,answer.slideToggle(state),tis.toggleClass("active",state),tis.attr("aria-expanded",state.toString()),tis.focus())})}),$("#name").on("keyup",function(e){var value,original_value;if(value=original_value=$(this).val(),9!==e.keyCode&&37!==e.keyCode&&38!==e.keyCode&&39!==e.keyCode&&40!==e.keyCode&&(value=function(s){return s=s.replace(/[^a-z0-9\s]/gi,"_")}(value=function(word){return word.split("").map(function(char){return cyrillic[char]||char}).join("")}(value=function(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}(value=(value=value.replace(/ /g,"_")).toLowerCase()))))!==original_value&&$(this).attr("value",value),void 0!=original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.addClass("hidemessage")}var $slugexists=$("#slugexists");"undefined"!=typeof cptui_type_data&&(cptui_type_data.existing_post_types.hasOwnProperty(value)&&value!==original_slug?$slugexists.removeClass("hidemessage"):$slugexists.addClass("hidemessage")),"undefined"!=typeof cptui_tax_data&&(cptui_tax_data.existing_taxonomies.hasOwnProperty(value)&&value!==original_slug?$slugexists.removeClass("hidemessage"):$slugexists.addClass("hidemessage"))});var cyrillic={"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"'","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"'","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"'","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"'","б":"b","ю":"yu"};if(void 0!=wp.media)var _custom_media=!0,_orig_send_attachment=wp.media.editor.send.attachment;$("#cptui_choose_icon").on("click",function(e){e.preventDefault();var button=$(this),id=jQuery("#menu_icon").attr("id");return _custom_media=!0,wp.media.editor.send.attachment=function(props,attachment){if(!_custom_media)return _orig_send_attachment.apply(this,[props,attachment]);$("#"+id).val(attachment.url)},wp.media.editor.open(button),!1}),$("#togglelabels").on("click",function(e){e.preventDefault(),$("#labels_expand").toggleClass("toggledclosed")}),$("#togglesettings").on("click",function(e){e.preventDefault(),$("#settings_expand").toggleClass("toggledclosed")}),$("#labels_expand,#settings_expand").on("focus",function(e){$(this).hasClass("toggledclosed")&&$(this).toggleClass("toggledclosed")}),$("#labels_expand legend,#settings_expand legend").on("click",function(e){$(this).parent().toggleClass("toggledclosed")}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){0==$(".cptui-table :checkbox:checked").length&&(e.preventDefault(),alert(cptui_tax_data.no_associated_type))})}(jQuery);
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williamsba1
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
|
4 |
Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
|
5 |
-
Requires at least: 4.
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPL-2.0+
|
9 |
Requires PHP: 5.2
|
10 |
|
@@ -31,12 +31,41 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
|
|
31 |
|
32 |
== Changelog ==
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
= 1.5.8 - 2018-04-16 =
|
35 |
* Fixed: Corrected issue with "Get Code" area regarding post types and "show in menu" field values.
|
36 |
* Fixed: Add post_format taxonomy support for CPTUI post types that declare post formats support. This primarily addresses issues with previewing changes for existing post type posts with post_format support.
|
37 |
* Fixed: Add "show_in_nav_menus" settings/output to tools section.
|
38 |
* Fixed: "Undefined index" notices for show_in_rest and rest_base settings.
|
39 |
-
* Updated: Change how we hide submit button when editing
|
40 |
* Updated sidebar links for Pluginize products.
|
41 |
|
42 |
= 1.5.7 - 2018-03-07 =
|
@@ -54,7 +83,7 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
|
|
54 |
* Fixed: Better accommodate possible labels with apostrophes, in relation to "Get code" functionality.
|
55 |
|
56 |
= 1.5.4 - 2017-06-22 =
|
57 |
-
* Fixed: Resolved saving issue around post types
|
58 |
* Fixed: Layout issues on about page.
|
59 |
|
60 |
= 1.5.3 - 2017-03-29 =
|
@@ -90,47 +119,43 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
|
|
90 |
* Updated: Changed appropriate help/support links to docs.pluginize.com.
|
91 |
* Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
|
92 |
|
93 |
-
= 1.4.3 - 2016-10-17 =
|
94 |
-
* Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
|
95 |
-
* Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
|
96 |
-
* Fixed: Prevent trying to redirect on activation if being network-activated.
|
97 |
-
|
98 |
-
= 1.4.2 - 2016-10-03 =
|
99 |
-
* Fixed: Responsiveness of sections and "ad" space when creating post types or taxonomies on smaller screens. Props @thecxguy
|
100 |
-
|
101 |
-
= 1.4.1 - 2016-8-25 =
|
102 |
-
* Fixed: issue with default values for new parameters regarding menu/nav menu display for taxonomies.
|
103 |
-
* Fixed: typo in support area.
|
104 |
-
|
105 |
-
= 1.4.0 - 2016-8-22 =
|
106 |
-
* Added: "Export" tab on editor screens for quick access to post type or taxonomy export pages.
|
107 |
-
* Added: CPTUI notices are now dismissable via a button on the right side.
|
108 |
-
* Added: "Get code" link to registered post types and registered taxonomies listings.
|
109 |
-
* Added: More amending of incorrect characters in post type and taxonomy slugs. Latin standard alphabet only. Sorry.
|
110 |
-
* Added: New post type template stack reference from recent WordPress versions.
|
111 |
-
* Added: Side warning notification if post type or taxonomy slug has been edited.
|
112 |
-
* Added: Display About page upon activation of plugin.
|
113 |
-
* Added: Link below ads regarding getting them removed via purchase of CPTUI Extended.
|
114 |
-
* Added: No need to refresh page after initial save to see post types and taxonomies in menu.
|
115 |
-
* Added: Taxonomy support for show_in_menu and show_in_nav_menus.
|
116 |
-
* Fixed: Further improved labels for information text on inputs.
|
117 |
-
* Fixed: Hide "choose icon" button for non-js users.
|
118 |
-
* Fixed: Issue with misused "parent" label key that should be parent_item_colon.
|
119 |
-
* Fixed: Missed show_in_menu_string parameter for "get code" area.
|
120 |
-
* Fixed: Make sure taxonomies have required post type associated.
|
121 |
-
* Fixed: "Edit" links in listings area now account for network-admin when needed, with CPTUI Extended.
|
122 |
-
* Updated: Switch to dedicated dashicon for color consistency between applied admin color schemes.
|
123 |
-
* Updated: Updated about page.
|
124 |
-
* Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
|
125 |
-
|
126 |
== Upgrade Notice ==
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
= 1.5.8 - 2018-04-16 =
|
129 |
* Fixed: Corrected issue with "Get Code" area regarding post types and "show in menu" field values.
|
130 |
* Fixed: Add post_format taxonomy support for CPTUI post types that declare post formats support. This primarily addresses issues with previewing changes for existing post type posts with post_format support.
|
131 |
* Fixed: Add "show_in_nav_menus" settings/output to tools section.
|
132 |
* Fixed: "Undefined index" notices for show_in_rest and rest_base settings.
|
133 |
-
* Updated: Change how we hide submit button when editing
|
134 |
* Updated sidebar links for Pluginize products.
|
135 |
|
136 |
= 1.5.7 - 2018-03-07 =
|
@@ -183,39 +208,6 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
|
|
183 |
* Updated: Changed appropriate help/support links to docs.pluginize.com.
|
184 |
* Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
|
185 |
|
186 |
-
= 1.4.3 - 2016-10-17 =
|
187 |
-
* Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
|
188 |
-
* Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
|
189 |
-
* Fixed: Prevent trying to redirect on activation if being network-activated.
|
190 |
-
|
191 |
-
= 1.4.2 - 2016-10-03 =
|
192 |
-
* Fixed: Responsiveness of sections and "ad" space when creating post types or taxonomies on smaller screens. Props @thecxguy
|
193 |
-
|
194 |
-
= 1.4.1 - 2016-8-25 =
|
195 |
-
* Fixed: issue with default values for new parameters regarding menu/nav menu display for taxonomies.
|
196 |
-
* Fixed: typo in support area.
|
197 |
-
|
198 |
-
= 1.4.0 - 2016-8-22 =
|
199 |
-
* Added: "Export" tab on editor screens for quick access to post type or taxonomy export pages.
|
200 |
-
* Added: CPTUI notices are now dismissable via a button on the right side.
|
201 |
-
* Added: "Get code" link to registered post types and registered taxonomies listings.
|
202 |
-
* Added: More amending of incorrect characters in post type and taxonomy slugs. Latin standard alphabet only. Sorry.
|
203 |
-
* Added: New post type template stack reference from recent WordPress versions.
|
204 |
-
* Added: Side warning notification if post type or taxonomy slug has been edited.
|
205 |
-
* Added: Display About page upon activation of plugin.
|
206 |
-
* Added: Link below ads regarding getting them removed via purchase of CPTUI Extended.
|
207 |
-
* Added: No need to refresh page after initial save to see post types and taxonomies in menu.
|
208 |
-
* Added: Taxonomy support for show_in_menu and show_in_nav_menus.
|
209 |
-
* Fixed: Further improved labels for information text on inputs.
|
210 |
-
* Fixed: Hide "choose icon" button for non-js users.
|
211 |
-
* Fixed: Issue with misused "parent" label key that should be parent_item_colon.
|
212 |
-
* Fixed: Missed show_in_menu_string parameter for "get code" area.
|
213 |
-
* Fixed: Make sure taxonomies have required post type associated.
|
214 |
-
* Fixed: "Edit" links in listings area now account for network-admin when needed, with CPTUI Extended.
|
215 |
-
* Updated: Switch to dedicated dashicon for color consistency between applied admin color schemes.
|
216 |
-
* Updated: Updated about page.
|
217 |
-
* Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
|
218 |
-
|
219 |
== Installation ==
|
220 |
|
221 |
= Admin Installer via search =
|
2 |
Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williamsba1
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
|
4 |
Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
|
5 |
+
Requires at least: 4.7
|
6 |
+
Tested up to: 4.9.8
|
7 |
+
Stable tag: 1.6.0
|
8 |
License: GPL-2.0+
|
9 |
Requires PHP: 5.2
|
10 |
|
31 |
|
32 |
== Changelog ==
|
33 |
|
34 |
+
= 1.6.0 - TBD =
|
35 |
+
* Added: Support for `meta_box_cb` parameter for `register_taxonomy` and taxonomies.
|
36 |
+
* Added: Dynamically warn about existing slugs.
|
37 |
+
* Added: "delete_with_user" support for post types.
|
38 |
+
* Added: Filters for post type and taxonomy data right before saving of final data.
|
39 |
+
* Added: `cptui_get_taxonomy_exists` function to check if a provided taxonomy is registered.
|
40 |
+
* Added: Required PHP version to readme.txt
|
41 |
+
* Added: Filter on taxonomies to be listed as available for association with a post type.
|
42 |
+
* Added: Warning indicators to our "Slug changed" and "Slug exists" warnings for post types and taxonomies.
|
43 |
+
* Added: Support for "publicly_queryable" parameter for taxonomies.
|
44 |
+
* Added: Support for "rest_controller_class" parameters for both post types and taxonomies.
|
45 |
+
* Added: Some initial WP-CLI support for importing and exporting CPTUI settings.
|
46 |
+
* Added: `name_admin_bar` support in post type labels.
|
47 |
+
* Added: Handling of array versions for "capability_type" field.
|
48 |
+
* Updated: Bump minimum WordPress version to 4.7.
|
49 |
+
* Updated: Pass the object_type array to `cptui_pre_register_taxonomy` filter as extra parameter.
|
50 |
+
* Updated: Adjusted preserved label handling to aid with plugin performance. Props alex-solovyev
|
51 |
+
* Updated: Utilize `wp_doing_ajax()` function for our AJAX checks.
|
52 |
+
* Updated: Clarify what is exported with the Post Types and Taxonomies spots for the Tools section.
|
53 |
+
* Updated: Clarify that the listed post types to associate to a CPTUI taxonomy are public post types by default.
|
54 |
+
* Updated: Make "Show In Rest" setting default to true for sake of easier Gutenberg integration in the future.
|
55 |
+
* Fixed: Only register archive slug if has_archive is set to true.
|
56 |
+
* Fixed: Error occurred when attempting to unset post types while editing a taxonomy.
|
57 |
+
* Fixed: Prevent errors from non-existant callback functions during post type or taxonomy processing.
|
58 |
+
* Fixed: Incorrect use of reserved taxonomy slugs function in a check for reserved post types.
|
59 |
+
* Fixed: Make sure "No post type selected" alert trigger from both buttons on the taxonomy settings edit screen.
|
60 |
+
* Fixed: Add our stylesheet only on our CPTUI pages. Fixes responsive bug on post editor screen.
|
61 |
+
* Fixed: Removed duplicate "label" in taxonomy "get code" section.
|
62 |
+
|
63 |
= 1.5.8 - 2018-04-16 =
|
64 |
* Fixed: Corrected issue with "Get Code" area regarding post types and "show in menu" field values.
|
65 |
* Fixed: Add post_format taxonomy support for CPTUI post types that declare post formats support. This primarily addresses issues with previewing changes for existing post type posts with post_format support.
|
66 |
* Fixed: Add "show_in_nav_menus" settings/output to tools section.
|
67 |
* Fixed: "Undefined index" notices for show_in_rest and rest_base settings.
|
68 |
+
* Updated: Change how we hide submit button when editing existing post types or taxes so switching is available if a javascript error occurs.
|
69 |
* Updated sidebar links for Pluginize products.
|
70 |
|
71 |
= 1.5.7 - 2018-03-07 =
|
83 |
* Fixed: Better accommodate possible labels with apostrophes, in relation to "Get code" functionality.
|
84 |
|
85 |
= 1.5.4 - 2017-06-22 =
|
86 |
+
* Fixed: Resolved saving issue around post types that matched existing page slugs.
|
87 |
* Fixed: Layout issues on about page.
|
88 |
|
89 |
= 1.5.3 - 2017-03-29 =
|
119 |
* Updated: Changed appropriate help/support links to docs.pluginize.com.
|
120 |
* Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
== Upgrade Notice ==
|
123 |
|
124 |
+
= 1.6.0 - TBD =
|
125 |
+
* Added: Support for `meta_box_cb` parameter for `register_taxonomy` and taxonomies.
|
126 |
+
* Added: Dynamically warn about existing slugs.
|
127 |
+
* Added: "delete_with_user" support for post types.
|
128 |
+
* Added: Filters for post type and taxonomy data right before saving of final data.
|
129 |
+
* Added: `cptui_get_taxonomy_exists` function to check if a provided taxonomy is registered.
|
130 |
+
* Added: Required PHP version to readme.txt
|
131 |
+
* Added: Filter on taxonomies to be listed as available for association with a post type.
|
132 |
+
* Added: Warning indicators to our "Slug changed" and "Slug exists" warnings for post types and taxonomies.
|
133 |
+
* Added: Support for "publicly_queryable" parameter for taxonomies.
|
134 |
+
* Added: Support for "rest_controller_class" parameters for both post types and taxonomies.
|
135 |
+
* Added: Some initial WP-CLI support for importing and exporting CPTUI settings.
|
136 |
+
* Added: `name_admin_bar` support in post type labels.
|
137 |
+
* Added: Handling of array versions for "capability_type" field.
|
138 |
+
* Updated: Bump minimum WordPress version to 4.7.
|
139 |
+
* Updated: Pass the object_type array to `cptui_pre_register_taxonomy` filter as extra parameter.
|
140 |
+
* Updated: Adjusted preserved label handling to aid with plugin performance. Props alex-solovyev
|
141 |
+
* Updated: Utilize `wp_doing_ajax()` function for our AJAX checks.
|
142 |
+
* Updated: Clarify what is exported with the Post Types and Taxonomies spots for the Tools section.
|
143 |
+
* Updated: Clarify that the listed post types to associate to a CPTUI taxonomy are public post types by default.
|
144 |
+
* Updated: Make "Show In Rest" setting default to true for sake of easier Gutenberg integration in the future.
|
145 |
+
* Fixed: Only register archive slug if has_archive is set to true.
|
146 |
+
* Fixed: Error occurred when attempting to unset post types while editing a taxonomy.
|
147 |
+
* Fixed: Prevent errors from non-existant callback functions during post type or taxonomy processing.
|
148 |
+
* Fixed: Incorrect use of reserved taxonomy slugs function in a check for reserved post types.
|
149 |
+
* Fixed: Make sure "No post type selected" alert trigger from both buttons on the taxonomy settings edit screen.
|
150 |
+
* Fixed: Add our stylesheet only on our CPTUI pages. Fixes responsive bug on post editor screen.
|
151 |
+
* Fixed: Removed duplicate "label" in taxonomy "get code" section.
|
152 |
+
|
153 |
= 1.5.8 - 2018-04-16 =
|
154 |
* Fixed: Corrected issue with "Get Code" area regarding post types and "show in menu" field values.
|
155 |
* Fixed: Add post_format taxonomy support for CPTUI post types that declare post formats support. This primarily addresses issues with previewing changes for existing post type posts with post_format support.
|
156 |
* Fixed: Add "show_in_nav_menus" settings/output to tools section.
|
157 |
* Fixed: "Undefined index" notices for show_in_rest and rest_base settings.
|
158 |
+
* Updated: Change how we hide submit button when editing existing post types or taxes so switching is available if a javascript error occurs.
|
159 |
* Updated sidebar links for Pluginize products.
|
160 |
|
161 |
= 1.5.7 - 2018-03-07 =
|
208 |
* Updated: Changed appropriate help/support links to docs.pluginize.com.
|
209 |
* Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
== Installation ==
|
212 |
|
213 |
= Admin Installer via search =
|