Version Description
- Block editor support
Download this release
Release Info
| Developer | johnjamesjacoby |
| Plugin | |
| Version | 3.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 3.1.0 to 3.2.0
- CHANGELOG.md +0 -75
- LICENSE +0 -340
- README.md +0 -55
- assets/js/block.js +1 -0
- assets/js/quickedit.js +2 -2
- post-type-switcher.php +205 -44
- readme.txt +10 -3
CHANGELOG.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
| 1 |
-
# Changelog
|
| 2 |
-
|
| 3 |
-
All notable changes to this project will be documented in this file.
|
| 4 |
-
This project adheres to [Semantic Versioning](http://semver.org/).
|
| 5 |
-
|
| 6 |
-
## 3.1.0
|
| 7 |
-
* Fix post targeting when called recursively
|
| 8 |
-
|
| 9 |
-
## 3.0.0
|
| 10 |
-
* Improved Quick-Edit and Bulk-Edit support
|
| 11 |
-
* Remove `attachment` type support for now, as there is no way to switch back
|
| 12 |
-
* Fix bug causing some post-types to switch unexpectedly
|
| 13 |
-
|
| 14 |
-
## 2.0.1
|
| 15 |
-
* Ensure quick-edit works with new procedure
|
| 16 |
-
* Quick-edit "Type" column works again!
|
| 17 |
-
|
| 18 |
-
## 2.0.0
|
| 19 |
-
* Improved plugin compatibility with WooThemes Sensei
|
| 20 |
-
* Filter post arguments vs. hook to save_post
|
| 21 |
-
* Add "post_type_switcher" action
|
| 22 |
-
|
| 23 |
-
## 1.7.0
|
| 24 |
-
* Add support for network activation
|
| 25 |
-
|
| 26 |
-
## 1.6
|
| 27 |
-
* Add textdomains for localization
|
| 28 |
-
* Load translation strings using load_plugin_textdomain()
|
| 29 |
-
* Before saving data chack if it's not an autosave using wp_is_post_autosave()
|
| 30 |
-
* Before saving data chack if it's not a revision using wp_is_post_revision()
|
| 31 |
-
* Security: Prevent direct access to directories
|
| 32 |
-
* Security: Translation strings escaping
|
| 33 |
-
* Add screenshots
|
| 34 |
-
|
| 35 |
-
## 1.5 - norcross
|
| 36 |
-
* Fix multiple quickedit dropdowns
|
| 37 |
-
|
| 38 |
-
## 1.4
|
| 39 |
-
* Improve handling of non-public post types
|
| 40 |
-
|
| 41 |
-
## 1.3
|
| 42 |
-
* Fix saving of autodrafts
|
| 43 |
-
|
| 44 |
-
## 1.2.1
|
| 45 |
-
* Improved WordPress 3.9 integration (added dashicon to publish metabox)
|
| 46 |
-
|
| 47 |
-
## 1.2
|
| 48 |
-
* Add bulk editing to supported post types
|
| 49 |
-
* Props Matthew Gerring for bulk edit contribution
|
| 50 |
-
|
| 51 |
-
## 1.1.1
|
| 52 |
-
* Add is_admin() check to prevent theme-side interference
|
| 53 |
-
* Change save_post priority to 999 to avoid plugin compatibility issues
|
| 54 |
-
* Remove ending closing php tag
|
| 55 |
-
* HTML and PHPDoc improvements
|
| 56 |
-
|
| 57 |
-
## 1.1
|
| 58 |
-
* Fix revisions being nooped
|
| 59 |
-
* Fix malformed HTML for some user roles
|
| 60 |
-
* Classificationate
|
| 61 |
-
|
| 62 |
-
## 1.0
|
| 63 |
-
* Fix JS bugs
|
| 64 |
-
* Audit post save bail conditions
|
| 65 |
-
* Tweak UI for WordPress 3.3
|
| 66 |
-
|
| 67 |
-
## 0.3
|
| 68 |
-
* Use the API to change the post type, fixing a conflict with persistent object caches
|
| 69 |
-
* No longer requires JavaScript
|
| 70 |
-
|
| 71 |
-
## 0.2
|
| 72 |
-
* Disallow post types that are not public and do not have a visible UI
|
| 73 |
-
|
| 74 |
-
## 0.1
|
| 75 |
-
* Release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LICENSE
DELETED
|
@@ -1,340 +0,0 @@
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
| 1 |
-
# Post Type Switcher
|
| 2 |
-
|
| 3 |
-
The simplest way to change a post's type in WordPress
|
| 4 |
-
|
| 5 |
-
## Description
|
| 6 |
-
|
| 7 |
-
This plugin adds a simple post type dropdown to the post editor interface, allowing you to reassign any post to a new post type. It allows you to switch post's type while editing your post.
|
| 8 |
-
|
| 9 |
-
### Supported Types
|
| 10 |
-
|
| 11 |
-
The plugin can convert nearly every combination of posts, pages, attachments, and even custom post types:
|
| 12 |
-
|
| 13 |
-
* Page to Post
|
| 14 |
-
* Post to Page
|
| 15 |
-
* Page to Attachment
|
| 16 |
-
* Post to Custom
|
| 17 |
-
|
| 18 |
-
Invisible post types, such as revisions, menus, etc., are purposely excluded. But, if you need to access invisible post types, you can adjust the boundaries using the 'pts_post_type_filter' filter.
|
| 19 |
-
|
| 20 |
-
### Bulk Editing
|
| 21 |
-
|
| 22 |
-
With bulk editing, thanks to Matthew Gerring, you can select all the posts in a certain type and convert them to a new type with one quick action.
|
| 23 |
-
|
| 24 |
-
## Installation
|
| 25 |
-
|
| 26 |
-
### Installation
|
| 27 |
-
1. In your WordPress Dashboard go to "Plugins" -> "Add Plugin".
|
| 28 |
-
2. Search for "Post Type Swticher".
|
| 29 |
-
3. Install the plugin by pressing the "Install" button.
|
| 30 |
-
4. Activate the plugin by pressing the "Activate" button.
|
| 31 |
-
5. From the post edit screen, above the "Publish" button is the "Post Type" interface.
|
| 32 |
-
6. Change post types as needed.
|
| 33 |
-
|
| 34 |
-
### Minimum Requirements
|
| 35 |
-
* WordPress version 3.0 or greater.
|
| 36 |
-
* PHP version 5.2.4 or greater.
|
| 37 |
-
* MySQL version 5.0 or greater.
|
| 38 |
-
|
| 39 |
-
### Recommended Requirements
|
| 40 |
-
* Latest WordPress version.
|
| 41 |
-
* PHP version 5.6 or greater.
|
| 42 |
-
* MySQL version 5.5 or greater.
|
| 43 |
-
|
| 44 |
-
## Frequently Asked Questions
|
| 45 |
-
|
| 46 |
-
### Why would I need this?
|
| 47 |
-
You need to selectively change a posts type from one to another.
|
| 48 |
-
|
| 49 |
-
### Does this ruin my taxonomy associations?
|
| 50 |
-
It should not. This plugin only changes the 'post_type' property of a post.
|
| 51 |
-
|
| 52 |
-
## Screenshots
|
| 53 |
-
1. "Type" column in "Posts" screen.
|
| 54 |
-
2. "Post Type" interface in "Quick Edit".
|
| 55 |
-
3. "Post Type" interface in "Edit Post" screen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/block.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
!function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=7)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e,o){var n=o(8);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e){function o(e){return t.exports=o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},o(e)}t.exports=o},function(t,e,o){var n=o(10),r=o(9);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?r(t):e}},function(t,e){function o(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){!function(){t.exports=this.wp.plugins}()},function(t,e,o){"use strict";o.r(e);var n=o(6),r=o(5),i=o.n(r),c=o(4),s=o.n(c),u=o(3),l=o.n(u),p=o(2),a=o.n(p),f=o(1),y=o.n(f),b=o(0),d=wp.components,m=d.Button,w=d.Dropdown,_=(d.PanelRow,wp.editPost.PluginPostStatusInfo),v=wp.element.Component,h=wp.i18n,g=h.sprintf,O=h.__,P=function(t){function e(t){var o;return i()(this,e),(o=l()(this,a()(e).apply(this,arguments))).state={currentPostType:window.ptsBlockEditor.currentPostType},o}return y()(e,t),s()(e,[{key:"render",value:function(){var t=this;return Object(b.createElement)("fieldset",{key:"post-type-switcher-selector",className:"editor-post-visibility__dialog-fieldset"},Object(b.createElement)("legend",{className:"editor-post-visibility__dialog-legend"},O("Post Type Switcher","post-type-switcher")),window.ptsBlockEditor.availablePostTypes.map(function(e){var o=e.value,n=e.label;return Object(b.createElement)("div",{key:o,className:"editor-post-visibility__choice"},Object(b.createElement)("input",{type:"radio",className:"editor-visibility__dialog-radio",name:"editor-post-visibility__setting",value:o,onChange:function(){var e=t.state.currentPostType;t.setState({currentPostType:o});var n=g(O("Are you sure you want to change this from a '%s' to a '%s'?","pts"),e,o);window.confirm(n)?window.location.href=window.ptsBlockEditor.changeUrl+"&pts_post_type="+o:t.setState({currentPostType:e})},checked:o===t.state.currentPostType,id:"editor-post-type-switcher-".concat(o)}),Object(b.createElement)("label",{htmlFor:"editor-post-type-switcher-".concat(o),className:"editor-post-visibility__dialog-label"},n))}))}}]),e}(v),j=function(t){t.children,t.className;return Object(b.createElement)(_,null,Object(b.createElement)("span",null,O("Post Type")),Object(b.createElement)(w,{position:"bottom left",contentClassName:"edit-post-post-visibility__dialog",renderToggle:function(t){var e=t.isOpen,o=t.onToggle;return Object(b.createElement)(m,{type:"button","aria-expanded":e,className:"edit-post-post-visibility__toggle",onClick:o,isLink:!0},window.ptsBlockEditor.currentPostTypeLabel)},renderContent:function(){return Object(b.createElement)(P,null)}}))};Object(n.registerPlugin)("post-type-switcher",{render:j})},function(t,e){function o(e,n){return t.exports=o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(e,n)}t.exports=o},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(e){return"function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?t.exports=n=function(t){return o(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":o(t)},n(e)}t.exports=n}]);
|
assets/js/quickedit.js
CHANGED
|
@@ -5,13 +5,13 @@ function pts_quick_edit() {
|
|
| 5 |
var _edit = inlineEditPost.edit;
|
| 6 |
|
| 7 |
$( '#bulk-edit' )
|
| 8 |
-
.find( '.inline-edit-col-right .inline-edit-col' )
|
| 9 |
.append(
|
| 10 |
$('#bulk-edit #pts_bulk_edit' )
|
| 11 |
);
|
| 12 |
|
| 13 |
$( '.inline-edit-row' ).not( '#bulk-edit' )
|
| 14 |
-
.find( '.inline-edit-col-right .inline-edit-col' )
|
| 15 |
.append(
|
| 16 |
$( '.inline-edit-row #pts_quick_edit' )
|
| 17 |
);
|
| 5 |
var _edit = inlineEditPost.edit;
|
| 6 |
|
| 7 |
$( '#bulk-edit' )
|
| 8 |
+
.find( '.inline-edit-col-right:first .inline-edit-col' )
|
| 9 |
.append(
|
| 10 |
$('#bulk-edit #pts_bulk_edit' )
|
| 11 |
);
|
| 12 |
|
| 13 |
$( '.inline-edit-row' ).not( '#bulk-edit' )
|
| 14 |
+
.find( '.inline-edit-col-right:first .inline-edit-col' )
|
| 15 |
.append(
|
| 16 |
$( '.inline-edit-row #pts_quick_edit' )
|
| 17 |
);
|
post-type-switcher.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
/**
|
| 4 |
* Post Type Switcher
|
| 5 |
*
|
|
@@ -16,7 +15,7 @@
|
|
| 16 |
* License: GPLv2 or later
|
| 17 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
| 18 |
* Description: Allow switching of a post type while editing a post (in post publish section)
|
| 19 |
-
* Version: 3.
|
| 20 |
* Text Domain: post-type-switcher
|
| 21 |
* Domain Path: /assets/lang/
|
| 22 |
*/
|
|
@@ -38,7 +37,7 @@ final class Post_Type_Switcher {
|
|
| 38 |
*
|
| 39 |
* @var int
|
| 40 |
*/
|
| 41 |
-
private $asset_version =
|
| 42 |
|
| 43 |
/**
|
| 44 |
* Hook in the basic early actions
|
|
@@ -74,21 +73,30 @@ final class Post_Type_Switcher {
|
|
| 74 |
}
|
| 75 |
|
| 76 |
// Add column for quick-edit support
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
// Add UI to "Publish" metabox
|
| 83 |
-
add_action( 'admin_head', array( $this, 'admin_head'
|
| 84 |
-
add_action( 'post_submitbox_misc_actions', array( $this, 'metabox'
|
| 85 |
-
add_action( 'quick_edit_custom_box', array( $this, 'quick_edit'
|
| 86 |
-
add_action( 'bulk_edit_custom_box', array( $this, 'quick_edit_bulk'
|
| 87 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'quick_edit_script'
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
// Override
|
| 90 |
-
|
| 91 |
-
add_filter( '
|
|
|
|
| 92 |
|
| 93 |
// Pass object into an action
|
| 94 |
do_action( 'post_type_switcher', $this );
|
|
@@ -102,8 +110,8 @@ final class Post_Type_Switcher {
|
|
| 102 |
public function metabox() {
|
| 103 |
|
| 104 |
// Post types
|
|
|
|
| 105 |
$post_type = get_post_type();
|
| 106 |
-
$post_types = get_post_types( $this->get_post_type_args(), 'objects' );
|
| 107 |
$cpt_object = get_post_type_object( $post_type );
|
| 108 |
|
| 109 |
// Bail if object does not exist or produces an error
|
|
@@ -117,11 +125,6 @@ final class Post_Type_Switcher {
|
|
| 117 |
$post_types[ $post_type ] = $cpt_object;
|
| 118 |
}
|
| 119 |
|
| 120 |
-
// Unset attachment types, since support seems to be broken
|
| 121 |
-
if ( isset( $post_types['attachment'] ) ) {
|
| 122 |
-
unset( $post_types['attachment'] );
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
?><div class="misc-pub-section misc-pub-section-last post-type-switcher">
|
| 126 |
<label for="pts_post_type"><?php esc_html_e( 'Post Type:', 'post-type-switcher' ); ?></label>
|
| 127 |
<span id="post-type-display"><?php echo esc_html( $cpt_object->labels->singular_name ); ?></span>
|
|
@@ -160,8 +163,10 @@ final class Post_Type_Switcher {
|
|
| 160 |
* Adds the post type column
|
| 161 |
*
|
| 162 |
* @since 1.2.0
|
|
|
|
|
|
|
| 163 |
*/
|
| 164 |
-
public function add_column( $columns ) {
|
| 165 |
return array_merge( $columns, array( 'post_type' => esc_html__( 'Type', 'post-type-switcher' ) ) );
|
| 166 |
}
|
| 167 |
|
|
@@ -169,23 +174,31 @@ final class Post_Type_Switcher {
|
|
| 169 |
* Manages the post type column
|
| 170 |
*
|
| 171 |
* @since 1.1.1
|
|
|
|
|
|
|
|
|
|
| 172 |
*/
|
| 173 |
-
public function manage_column( $
|
| 174 |
-
switch( $column ) {
|
| 175 |
-
case 'post_type' :
|
| 176 |
-
$post_type = get_post_type_object( get_post_type( $post_id ) ); ?>
|
| 177 |
-
|
| 178 |
-
<span data-post-type="<?php echo esc_attr( $post_type->name ); ?>"><?php echo esc_html( $post_type->labels->singular_name ); ?></span>
|
| 179 |
|
| 180 |
-
|
| 181 |
-
|
|
|
|
| 182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
/**
|
| 186 |
-
* Adds
|
| 187 |
*
|
| 188 |
* @since 1.2.0
|
|
|
|
|
|
|
| 189 |
*/
|
| 190 |
public function quick_edit( $column_name = '' ) {
|
| 191 |
|
|
@@ -209,9 +222,11 @@ final class Post_Type_Switcher {
|
|
| 209 |
}
|
| 210 |
|
| 211 |
/**
|
| 212 |
-
* Adds
|
| 213 |
*
|
| 214 |
* @since 1.2.0
|
|
|
|
|
|
|
| 215 |
*/
|
| 216 |
public function quick_edit_bulk( $column_name = '' ) {
|
| 217 |
|
|
@@ -233,7 +248,7 @@ final class Post_Type_Switcher {
|
|
| 233 |
}
|
| 234 |
|
| 235 |
/**
|
| 236 |
-
* Adds
|
| 237 |
*
|
| 238 |
* @since 1.2
|
| 239 |
*/
|
|
@@ -248,6 +263,77 @@ final class Post_Type_Switcher {
|
|
| 248 |
wp_enqueue_script( 'pts_quickedit', plugin_dir_url( __FILE__ ) . 'assets/js/quickedit.js', array( 'jquery' ), $this->asset_version, true );
|
| 249 |
}
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
/**
|
| 252 |
* Output a post-type dropdown
|
| 253 |
*
|
|
@@ -256,16 +342,10 @@ final class Post_Type_Switcher {
|
|
| 256 |
public function select_box( $bulk = false ) {
|
| 257 |
|
| 258 |
// Get post type specific data
|
| 259 |
-
$
|
| 260 |
-
$post_types = get_post_types( $args, 'objects' );
|
| 261 |
$post_type = get_post_type();
|
| 262 |
$selected = '';
|
| 263 |
|
| 264 |
-
// Unset attachment types, since support seems to be broken
|
| 265 |
-
if ( isset( $post_types['attachment'] ) ) {
|
| 266 |
-
unset( $post_types['attachment'] );
|
| 267 |
-
}
|
| 268 |
-
|
| 269 |
// Start an output buffer
|
| 270 |
ob_start();
|
| 271 |
|
|
@@ -301,6 +381,44 @@ final class Post_Type_Switcher {
|
|
| 301 |
echo ob_get_clean();
|
| 302 |
}
|
| 303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
/**
|
| 305 |
* Override post_type in wp_insert_post()
|
| 306 |
*
|
|
@@ -458,6 +576,9 @@ final class Post_Type_Switcher {
|
|
| 458 |
text-decoration: none !important;
|
| 459 |
color: #888;
|
| 460 |
}
|
|
|
|
|
|
|
|
|
|
| 461 |
</style>
|
| 462 |
|
| 463 |
<?php
|
|
@@ -472,14 +593,32 @@ final class Post_Type_Switcher {
|
|
| 472 |
*/
|
| 473 |
private static function is_allowed_page() {
|
| 474 |
|
| 475 |
-
|
| 476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
|
| 478 |
// Allowed admin pages
|
| 479 |
$pages = apply_filters( 'pts_allowed_pages', array(
|
| 480 |
'post.php',
|
| 481 |
'edit.php',
|
| 482 |
-
'admin-ajax.php'
|
| 483 |
) );
|
| 484 |
|
| 485 |
// Only show switcher when editing
|
|
@@ -491,8 +630,30 @@ final class Post_Type_Switcher {
|
|
| 491 |
}
|
| 492 |
|
| 493 |
/**
|
| 494 |
-
*
|
| 495 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
*
|
| 497 |
* @since 2.0.0
|
| 498 |
*
|
| 1 |
<?php
|
|
|
|
| 2 |
/**
|
| 3 |
* Post Type Switcher
|
| 4 |
*
|
| 15 |
* License: GPLv2 or later
|
| 16 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
| 17 |
* Description: Allow switching of a post type while editing a post (in post publish section)
|
| 18 |
+
* Version: 3.2.0
|
| 19 |
* Text Domain: post-type-switcher
|
| 20 |
* Domain Path: /assets/lang/
|
| 21 |
*/
|
| 37 |
*
|
| 38 |
* @var int
|
| 39 |
*/
|
| 40 |
+
private $asset_version = 201904300001;
|
| 41 |
|
| 42 |
/**
|
| 43 |
* Hook in the basic early actions
|
| 73 |
}
|
| 74 |
|
| 75 |
// Add column for quick-edit support
|
| 76 |
+
$post_type_names = $this->get_post_types( 'names' );
|
| 77 |
+
|
| 78 |
+
// Add filters if post-types are switchable
|
| 79 |
+
if ( ! empty( $post_type_names ) ) {
|
| 80 |
+
foreach ( $post_type_names as $name ) {
|
| 81 |
+
add_filter( "manage_{$name}_posts_columns", array( $this, 'add_column' ) );
|
| 82 |
+
add_action( "manage_{$name}_posts_custom_column", array( $this, 'manage_column' ), 10, 2 );
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
|
| 86 |
// Add UI to "Publish" metabox
|
| 87 |
+
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
| 88 |
+
add_action( 'post_submitbox_misc_actions', array( $this, 'metabox' ) );
|
| 89 |
+
add_action( 'quick_edit_custom_box', array( $this, 'quick_edit' ) );
|
| 90 |
+
add_action( 'bulk_edit_custom_box', array( $this, 'quick_edit_bulk' ) );
|
| 91 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'quick_edit_script' ) );
|
| 92 |
+
|
| 93 |
+
// Add UI to the block editor
|
| 94 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'block_editor_assets' ) );
|
| 95 |
|
| 96 |
// Override
|
| 97 |
+
add_action( 'wp_ajax_post_type_switcher', array( $this, 'handle_ajax' ) );
|
| 98 |
+
add_filter( 'wp_insert_attachment_data', array( $this, 'override_type' ), 10, 2 );
|
| 99 |
+
add_filter( 'wp_insert_post_data', array( $this, 'override_type' ), 10, 2 );
|
| 100 |
|
| 101 |
// Pass object into an action
|
| 102 |
do_action( 'post_type_switcher', $this );
|
| 110 |
public function metabox() {
|
| 111 |
|
| 112 |
// Post types
|
| 113 |
+
$post_types = $this->get_post_types();
|
| 114 |
$post_type = get_post_type();
|
|
|
|
| 115 |
$cpt_object = get_post_type_object( $post_type );
|
| 116 |
|
| 117 |
// Bail if object does not exist or produces an error
|
| 125 |
$post_types[ $post_type ] = $cpt_object;
|
| 126 |
}
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
?><div class="misc-pub-section misc-pub-section-last post-type-switcher">
|
| 129 |
<label for="pts_post_type"><?php esc_html_e( 'Post Type:', 'post-type-switcher' ); ?></label>
|
| 130 |
<span id="post-type-display"><?php echo esc_html( $cpt_object->labels->singular_name ); ?></span>
|
| 163 |
* Adds the post type column
|
| 164 |
*
|
| 165 |
* @since 1.2.0
|
| 166 |
+
*
|
| 167 |
+
* @param array $columns Array of registered columns
|
| 168 |
*/
|
| 169 |
+
public function add_column( $columns = array() ) {
|
| 170 |
return array_merge( $columns, array( 'post_type' => esc_html__( 'Type', 'post-type-switcher' ) ) );
|
| 171 |
}
|
| 172 |
|
| 174 |
* Manages the post type column
|
| 175 |
*
|
| 176 |
* @since 1.1.1
|
| 177 |
+
*
|
| 178 |
+
* @param string $column_name Name of column
|
| 179 |
+
* @param int $post_id ID of post
|
| 180 |
*/
|
| 181 |
+
public function manage_column( $column_name = '', $post_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
+
// Bail if not the post_type column
|
| 184 |
+
if ( 'post_type' !== $column_name ) {
|
| 185 |
+
return;
|
| 186 |
}
|
| 187 |
+
|
| 188 |
+
// Get the post type object to get the names from it
|
| 189 |
+
$post_type = get_post_type_object( get_post_type( $post_id ) ); ?>
|
| 190 |
+
|
| 191 |
+
<span data-post-type="<?php echo esc_attr( $post_type->name ); ?>"><?php echo esc_html( $post_type->labels->singular_name ); ?></span>
|
| 192 |
+
|
| 193 |
+
<?php
|
| 194 |
}
|
| 195 |
|
| 196 |
/**
|
| 197 |
+
* Adds quick-edit button for bulk-editing post types
|
| 198 |
*
|
| 199 |
* @since 1.2.0
|
| 200 |
+
*
|
| 201 |
+
* @param string $column_name Name of column
|
| 202 |
*/
|
| 203 |
public function quick_edit( $column_name = '' ) {
|
| 204 |
|
| 222 |
}
|
| 223 |
|
| 224 |
/**
|
| 225 |
+
* Adds quick-edit button for bulk-editing post types
|
| 226 |
*
|
| 227 |
* @since 1.2.0
|
| 228 |
+
*
|
| 229 |
+
* @param string $column_name Name of column
|
| 230 |
*/
|
| 231 |
public function quick_edit_bulk( $column_name = '' ) {
|
| 232 |
|
| 248 |
}
|
| 249 |
|
| 250 |
/**
|
| 251 |
+
* Adds quick-edit script for getting values into quick-edit box
|
| 252 |
*
|
| 253 |
* @since 1.2
|
| 254 |
*/
|
| 263 |
wp_enqueue_script( 'pts_quickedit', plugin_dir_url( __FILE__ ) . 'assets/js/quickedit.js', array( 'jquery' ), $this->asset_version, true );
|
| 264 |
}
|
| 265 |
|
| 266 |
+
/**
|
| 267 |
+
* Enqueues modifications to the block editor.
|
| 268 |
+
*
|
| 269 |
+
* @since 3.2.0
|
| 270 |
+
*/
|
| 271 |
+
public function block_editor_assets() {
|
| 272 |
+
|
| 273 |
+
// Bail if current user cannot publish the current post type
|
| 274 |
+
$current_post_type = get_post_type();
|
| 275 |
+
$current_post_type_object = get_post_type_object( $current_post_type );
|
| 276 |
+
if ( ! current_user_can( $current_post_type_object->cap->publish_posts ) ) {
|
| 277 |
+
return;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
// Get all switchable types
|
| 281 |
+
$switchable_types = $this->get_post_types();
|
| 282 |
+
|
| 283 |
+
// Bail if no switchable types
|
| 284 |
+
if ( empty( $switchable_types ) ) {
|
| 285 |
+
return;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
// Default empty available types array
|
| 289 |
+
$available_post_types = array();
|
| 290 |
+
|
| 291 |
+
// Loop through switchable types
|
| 292 |
+
foreach ( $switchable_types as $post_type ) {
|
| 293 |
+
|
| 294 |
+
// Skip if user cannot switch to
|
| 295 |
+
if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
|
| 296 |
+
continue;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// Setup value/label to be localized below
|
| 300 |
+
$available_post_types[] = array(
|
| 301 |
+
'value' => $post_type->name,
|
| 302 |
+
'label' => $post_type->labels->singular_name,
|
| 303 |
+
);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// Setup the AJAX URL used to send the change request to
|
| 307 |
+
$change_url = add_query_arg(
|
| 308 |
+
array(
|
| 309 |
+
'action' => 'post_type_switcher',
|
| 310 |
+
'pts-nonce-select' => wp_create_nonce( 'post-type-selector' ),
|
| 311 |
+
'post_id' => get_the_ID(),
|
| 312 |
+
),
|
| 313 |
+
admin_url( 'admin-ajax.php' )
|
| 314 |
+
);
|
| 315 |
+
|
| 316 |
+
// Enqueue the block editor script
|
| 317 |
+
wp_enqueue_script(
|
| 318 |
+
'pts_blockeditor',
|
| 319 |
+
plugin_dir_url( __FILE__ ) . 'assets/js/block.js',
|
| 320 |
+
array( 'wp-components', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
|
| 321 |
+
$this->asset_version
|
| 322 |
+
);
|
| 323 |
+
|
| 324 |
+
// Localize the block editor script variables
|
| 325 |
+
wp_localize_script(
|
| 326 |
+
'pts_blockeditor',
|
| 327 |
+
'ptsBlockEditor',
|
| 328 |
+
array(
|
| 329 |
+
'availablePostTypes' => $available_post_types,
|
| 330 |
+
'currentPostType' => $current_post_type,
|
| 331 |
+
'currentPostTypeLabel' => $current_post_type_object->labels->singular_name,
|
| 332 |
+
'changeUrl' => $change_url
|
| 333 |
+
)
|
| 334 |
+
);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
/**
|
| 338 |
* Output a post-type dropdown
|
| 339 |
*
|
| 342 |
public function select_box( $bulk = false ) {
|
| 343 |
|
| 344 |
// Get post type specific data
|
| 345 |
+
$post_types = $this->get_post_types();
|
|
|
|
| 346 |
$post_type = get_post_type();
|
| 347 |
$selected = '';
|
| 348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 349 |
// Start an output buffer
|
| 350 |
ob_start();
|
| 351 |
|
| 381 |
echo ob_get_clean();
|
| 382 |
}
|
| 383 |
|
| 384 |
+
/**
|
| 385 |
+
* Handles an admin-ajax request to change post types.
|
| 386 |
+
*
|
| 387 |
+
* Note that these use $_GET values specifically, to avoid collisions with
|
| 388 |
+
* upstream requests.
|
| 389 |
+
*
|
| 390 |
+
* @since 3.2.0
|
| 391 |
+
*/
|
| 392 |
+
public function handle_ajax() {
|
| 393 |
+
|
| 394 |
+
// Bail if missing data
|
| 395 |
+
if (
|
| 396 |
+
empty( $_GET['pts_post_type'] )
|
| 397 |
+
|| empty( $_GET['pts-nonce-select'] )
|
| 398 |
+
|| empty( $_GET['post_id'] )
|
| 399 |
+
) {
|
| 400 |
+
return wp_die( esc_html__( 'Missing data.', 'post-type-switcher' ) );
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
// Post type information
|
| 404 |
+
$post_id = absint( $_GET['post_id'] );
|
| 405 |
+
$post_type = sanitize_key( $_GET['pts_post_type'] );
|
| 406 |
+
$post_type_object = get_post_type_object( $post_type );
|
| 407 |
+
|
| 408 |
+
// Bail if user isn't capable or nonce fails
|
| 409 |
+
if ( ! current_user_can( $post_type_object->cap->publish_posts )
|
| 410 |
+
|| ! wp_verify_nonce( $_GET['pts-nonce-select'], 'post-type-selector' ) ) {
|
| 411 |
+
return wp_die( esc_html__( 'Sorry, you cannot do this.', 'post-type-switcher' ) );
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
// Update the post type
|
| 415 |
+
set_post_type( $post_id, $post_type );
|
| 416 |
+
|
| 417 |
+
// Redirect
|
| 418 |
+
wp_safe_redirect( get_edit_post_link( $post_id, 'raw' ) );
|
| 419 |
+
exit;
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
/**
|
| 423 |
* Override post_type in wp_insert_post()
|
| 424 |
*
|
| 576 |
text-decoration: none !important;
|
| 577 |
color: #888;
|
| 578 |
}
|
| 579 |
+
.wp-list-table .column-post_type {
|
| 580 |
+
width: 10%;
|
| 581 |
+
}
|
| 582 |
</style>
|
| 583 |
|
| 584 |
<?php
|
| 593 |
*/
|
| 594 |
private static function is_allowed_page() {
|
| 595 |
|
| 596 |
+
if (
|
| 597 |
+
// Only for admin area
|
| 598 |
+
is_blog_admin()
|
| 599 |
+
|
| 600 |
+
// OR
|
| 601 |
+
||
|
| 602 |
+
|
| 603 |
+
// AJAX with correct action value
|
| 604 |
+
(
|
| 605 |
+
defined( 'DOING_AJAX' ) && DOING_AJAX
|
| 606 |
+
&&
|
| 607 |
+
(
|
| 608 |
+
! empty( $_REQUEST['action'] )
|
| 609 |
+
&&
|
| 610 |
+
(
|
| 611 |
+
in_array( $_REQUEST['action'], array( 'inline-save', 'post_type_switcher' ), true )
|
| 612 |
+
)
|
| 613 |
+
)
|
| 614 |
+
)
|
| 615 |
+
) {
|
| 616 |
|
| 617 |
// Allowed admin pages
|
| 618 |
$pages = apply_filters( 'pts_allowed_pages', array(
|
| 619 |
'post.php',
|
| 620 |
'edit.php',
|
| 621 |
+
'admin-ajax.php' // Block Editor
|
| 622 |
) );
|
| 623 |
|
| 624 |
// Only show switcher when editing
|
| 630 |
}
|
| 631 |
|
| 632 |
/**
|
| 633 |
+
* Get switchable post type objects, based on post-type arguments.
|
| 634 |
+
*
|
| 635 |
+
* @since 3.2.0
|
| 636 |
+
*
|
| 637 |
+
* @param string $output objects|names
|
| 638 |
+
* @return array
|
| 639 |
+
*/
|
| 640 |
+
private function get_post_types( $output = 'objects' ) {
|
| 641 |
+
|
| 642 |
+
// Get switchable types
|
| 643 |
+
$types = get_post_types( $this->get_post_type_args(), $output );
|
| 644 |
+
|
| 645 |
+
// Unset attachment types, since support seems to be broken
|
| 646 |
+
if ( isset( $types['attachment'] ) ) {
|
| 647 |
+
unset( $types['attachment'] );
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
// Return switchable types
|
| 651 |
+
return $types;
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
/**
|
| 655 |
+
* Returns the array of arguments used to narrow down the switchable post
|
| 656 |
+
* types from the globally registered $wp_post_types array.
|
| 657 |
*
|
| 658 |
* @since 2.0.0
|
| 659 |
*
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: johnjamesjacoby, beatpanda, norcross, stuttter
|
| 3 |
Tags: post, page, type, types, post type
|
| 4 |
Requires at least: 3.0
|
| 5 |
-
Tested up to:
|
| 6 |
-
Stable tag: 3.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9Q4F4EL5YJ62J
|
|
@@ -29,7 +29,11 @@ Invisible post types, such as revisions, menus, etc., are purposely excluded. Bu
|
|
| 29 |
|
| 30 |
= Bulk Editing =
|
| 31 |
|
| 32 |
-
With bulk editing
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
== Installation ==
|
| 35 |
|
|
@@ -66,6 +70,9 @@ It should not. This plugin only changes the 'post_type' property of a post.
|
|
| 66 |
|
| 67 |
== Changelog ==
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
= 3.1.0 =
|
| 70 |
* Fix post targeting when called recursively
|
| 71 |
|
| 2 |
Contributors: johnjamesjacoby, beatpanda, norcross, stuttter
|
| 3 |
Tags: post, page, type, types, post type
|
| 4 |
Requires at least: 3.0
|
| 5 |
+
Tested up to: 5.3
|
| 6 |
+
Stable tag: 3.2.0
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9Q4F4EL5YJ62J
|
| 29 |
|
| 30 |
= Bulk Editing =
|
| 31 |
|
| 32 |
+
With bulk editing (thanks to Matthew Gerring) you can select all the posts in a certain type and convert them to a new type with one quick action.
|
| 33 |
+
|
| 34 |
+
= Block Editor =
|
| 35 |
+
|
| 36 |
+
With block-editor (aka Gutenberg) support (thanks to Daniel Bachhuber) you can switch between post-types that use either the Block Editor and the Classic one, without losing any of your embedded content.
|
| 37 |
|
| 38 |
== Installation ==
|
| 39 |
|
| 70 |
|
| 71 |
== Changelog ==
|
| 72 |
|
| 73 |
+
= 3.2.0 =
|
| 74 |
+
* Block editor support
|
| 75 |
+
|
| 76 |
= 3.1.0 =
|
| 77 |
* Fix post targeting when called recursively
|
| 78 |
|
