Version Description
- Fix post targeting when called recursively
Download this release
Release Info
| Developer | johnjamesjacoby |
| Plugin | |
| Version | 3.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.1 to 3.1.0
- CHANGELOG.md +75 -0
- LICENSE +340 -0
- README.md +55 -0
- assets/js/quickedit.js +20 -8
- post-type-switcher.php +118 -33
- readme.txt +38 -25
CHANGELOG.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
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 |
+
|
README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/quickedit.js
CHANGED
|
@@ -4,9 +4,21 @@ function pts_quick_edit() {
|
|
| 4 |
var $ = jQuery;
|
| 5 |
var _edit = inlineEditPost.edit;
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
inlineEditPost.edit = function( id ) {
|
| 8 |
|
| 9 |
-
var args = [].slice.call(arguments );
|
| 10 |
|
| 11 |
_edit.apply( this, args );
|
| 12 |
|
|
@@ -16,17 +28,17 @@ function pts_quick_edit() {
|
|
| 16 |
|
| 17 |
var
|
| 18 |
|
| 19 |
-
//
|
| 20 |
-
|
| 21 |
|
| 22 |
-
//
|
| 23 |
-
|
| 24 |
|
| 25 |
// get the existing values
|
| 26 |
-
post_type = $( '.post_type',
|
| 27 |
-
|
| 28 |
// set the values in the quick-editor
|
| 29 |
-
$( 'select[name="pts_post_type"] option[value="' + post_type + '"]',
|
| 30 |
};
|
| 31 |
}
|
| 32 |
|
| 4 |
var $ = jQuery;
|
| 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 |
+
);
|
| 18 |
+
|
| 19 |
inlineEditPost.edit = function( id ) {
|
| 20 |
|
| 21 |
+
var args = [].slice.call( arguments );
|
| 22 |
|
| 23 |
_edit.apply( this, args );
|
| 24 |
|
| 28 |
|
| 29 |
var
|
| 30 |
|
| 31 |
+
// edit_row is the quick-edit row, containing the inputs that need to be updated
|
| 32 |
+
edit_row = $( '#edit-' + id ),
|
| 33 |
|
| 34 |
+
// post_row is the row shown when a book isn't being edited, which also holds the existing values.
|
| 35 |
+
post_row = $( '#post-' + id ),
|
| 36 |
|
| 37 |
// get the existing values
|
| 38 |
+
post_type = $( 'td.post_type span', post_row ).data( 'post-type' );
|
| 39 |
+
|
| 40 |
// set the values in the quick-editor
|
| 41 |
+
$( 'select[name="pts_post_type"] option[value="' + post_type + '"]', edit_row ).attr( 'selected', 'selected' );
|
| 42 |
};
|
| 43 |
}
|
| 44 |
|
post-type-switcher.php
CHANGED
|
@@ -16,7 +16,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:
|
| 20 |
* Text Domain: post-type-switcher
|
| 21 |
* Domain Path: /assets/lang/
|
| 22 |
*/
|
|
@@ -31,6 +31,15 @@ defined( 'ABSPATH' ) || exit;
|
|
| 31 |
*/
|
| 32 |
final class Post_Type_Switcher {
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
/**
|
| 35 |
* Hook in the basic early actions
|
| 36 |
*
|
|
@@ -71,11 +80,11 @@ final class Post_Type_Switcher {
|
|
| 71 |
add_action( 'manage_pages_custom_column', array( $this, 'manage_column' ), 10, 2 );
|
| 72 |
|
| 73 |
// Add UI to "Publish" metabox
|
| 74 |
-
add_action( 'admin_head', array( $this, 'admin_head'
|
| 75 |
-
add_action( 'post_submitbox_misc_actions', array( $this, 'metabox'
|
| 76 |
-
add_action( 'quick_edit_custom_box', array( $this, '
|
| 77 |
-
add_action( 'bulk_edit_custom_box', array( $this, '
|
| 78 |
-
add_action(
|
| 79 |
|
| 80 |
// Override
|
| 81 |
add_filter( 'wp_insert_attachment_data', array( $this, 'override_type' ), 10, 2 );
|
|
@@ -86,9 +95,7 @@ final class Post_Type_Switcher {
|
|
| 86 |
}
|
| 87 |
|
| 88 |
/**
|
| 89 |
-
*
|
| 90 |
-
*
|
| 91 |
-
* Adds post_publish metabox to allow changing post_type
|
| 92 |
*
|
| 93 |
* @since 1.0.0
|
| 94 |
*/
|
|
@@ -108,9 +115,14 @@ final class Post_Type_Switcher {
|
|
| 108 |
// https://wordpress.org/support/topic/dont-show-for-non-public-post-types?replies=4#post-5849287
|
| 109 |
if ( ! in_array( $cpt_object, $post_types, true ) ) {
|
| 110 |
$post_types[ $post_type ] = $cpt_object;
|
| 111 |
-
}
|
| 112 |
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
<label for="pts_post_type"><?php esc_html_e( 'Post Type:', 'post-type-switcher' ); ?></label>
|
| 115 |
<span id="post-type-display"><?php echo esc_html( $cpt_object->labels->singular_name ); ?></span>
|
| 116 |
|
|
@@ -175,25 +187,47 @@ final class Post_Type_Switcher {
|
|
| 175 |
*
|
| 176 |
* @since 1.2.0
|
| 177 |
*/
|
| 178 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
// Bail to prevent multiple dropdowns in each column
|
| 181 |
if ( 'post_type' !== $column_name ) {
|
| 182 |
return;
|
| 183 |
} ?>
|
| 184 |
|
| 185 |
-
<
|
| 186 |
-
<
|
| 187 |
-
<label class="alignleft">
|
| 188 |
-
<span class="title"><?php esc_html_e( 'Post Type', 'post-type-switcher' ); ?></span><?php
|
| 189 |
|
| 190 |
-
|
| 191 |
|
| 192 |
-
|
| 193 |
|
| 194 |
-
|
| 195 |
-
</div>
|
| 196 |
-
</fieldset>
|
| 197 |
|
| 198 |
<?php
|
| 199 |
}
|
|
@@ -203,13 +237,15 @@ final class Post_Type_Switcher {
|
|
| 203 |
*
|
| 204 |
* @since 1.2
|
| 205 |
*/
|
| 206 |
-
public function
|
| 207 |
|
|
|
|
| 208 |
if ( 'edit.php' !== $hook ) {
|
| 209 |
return;
|
| 210 |
}
|
| 211 |
|
| 212 |
-
|
|
|
|
| 213 |
}
|
| 214 |
|
| 215 |
/**
|
|
@@ -217,24 +253,52 @@ final class Post_Type_Switcher {
|
|
| 217 |
*
|
| 218 |
* @since 1.2
|
| 219 |
*/
|
| 220 |
-
public function select_box() {
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
| 222 |
$post_type = get_post_type();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
?><select name="pts_post_type" id="pts_post_type"><?php
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
foreach ( $post_types as $_post_type => $pt ) :
|
| 227 |
|
|
|
|
| 228 |
if ( ! current_user_can( $pt->cap->publish_posts ) ) :
|
| 229 |
continue;
|
| 230 |
endif;
|
| 231 |
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
endforeach;
|
| 235 |
|
| 236 |
?></select><?php
|
| 237 |
|
|
|
|
|
|
|
| 238 |
}
|
| 239 |
|
| 240 |
/**
|
|
@@ -265,20 +329,43 @@ final class Post_Type_Switcher {
|
|
| 265 |
return $data;
|
| 266 |
}
|
| 267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
// Post type information
|
|
|
|
| 269 |
$post_type = sanitize_key( $_REQUEST['pts_post_type'] );
|
| 270 |
$post_type_object = get_post_type_object( $post_type );
|
| 271 |
|
| 272 |
// Bail if empty post type
|
| 273 |
-
if ( empty( $post_type ) || empty( $post_type_object ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
return $data;
|
| 275 |
}
|
| 276 |
|
| 277 |
-
// Bail if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
if ( ! current_user_can( 'edit_post', $postarr['ID'] ) ) {
|
| 279 |
return $data;
|
| 280 |
}
|
| 281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
// Bail if nonce is invalid
|
| 283 |
if ( ! wp_verify_nonce( $_REQUEST['pts-nonce-select'], 'post-type-selector' ) ) {
|
| 284 |
return $data;
|
|
@@ -299,11 +386,6 @@ final class Post_Type_Switcher {
|
|
| 299 |
return $data;
|
| 300 |
}
|
| 301 |
|
| 302 |
-
// Bail if user cannot 'publish_posts' on the new type
|
| 303 |
-
if ( ! current_user_can( $post_type_object->cap->publish_posts ) ) {
|
| 304 |
-
return $data;
|
| 305 |
-
}
|
| 306 |
-
|
| 307 |
// Update post type
|
| 308 |
$data['post_type'] = $post_type;
|
| 309 |
|
|
@@ -343,6 +425,9 @@ final class Post_Type_Switcher {
|
|
| 343 |
});
|
| 344 |
</script>
|
| 345 |
<style type="text/css">
|
|
|
|
|
|
|
|
|
|
| 346 |
#post-type-select {
|
| 347 |
line-height: 2.5em;
|
| 348 |
margin-top: 3px;
|
| 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.1.0
|
| 20 |
* Text Domain: post-type-switcher
|
| 21 |
* Domain Path: /assets/lang/
|
| 22 |
*/
|
| 31 |
*/
|
| 32 |
final class Post_Type_Switcher {
|
| 33 |
|
| 34 |
+
/**
|
| 35 |
+
* Asset version, for cache busting
|
| 36 |
+
*
|
| 37 |
+
* @since 3.0.1
|
| 38 |
+
*
|
| 39 |
+
* @var int
|
| 40 |
+
*/
|
| 41 |
+
private $asset_version = 201609170001;
|
| 42 |
+
|
| 43 |
/**
|
| 44 |
* Hook in the basic early actions
|
| 45 |
*
|
| 80 |
add_action( 'manage_pages_custom_column', array( $this, 'manage_column' ), 10, 2 );
|
| 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 |
add_filter( 'wp_insert_attachment_data', array( $this, 'override_type' ), 10, 2 );
|
| 95 |
}
|
| 96 |
|
| 97 |
/**
|
| 98 |
+
* Output meta box fields on New/Edit Post screen
|
|
|
|
|
|
|
| 99 |
*
|
| 100 |
* @since 1.0.0
|
| 101 |
*/
|
| 115 |
// https://wordpress.org/support/topic/dont-show-for-non-public-post-types?replies=4#post-5849287
|
| 116 |
if ( ! in_array( $cpt_object, $post_types, true ) ) {
|
| 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>
|
| 128 |
|
| 187 |
*
|
| 188 |
* @since 1.2.0
|
| 189 |
*/
|
| 190 |
+
public function quick_edit( $column_name = '' ) {
|
| 191 |
+
|
| 192 |
+
// Bail to prevent multiple dropdowns in each column
|
| 193 |
+
if ( 'post_type' !== $column_name ) {
|
| 194 |
+
return;
|
| 195 |
+
} ?>
|
| 196 |
+
|
| 197 |
+
<div id="pts_quick_edit" class="inline-edit-group wp-clearfix">
|
| 198 |
+
<label class="alignleft">
|
| 199 |
+
<span class="title"><?php esc_html_e( 'Post Type', 'post-type-switcher' ); ?></span><?php
|
| 200 |
+
|
| 201 |
+
wp_nonce_field( 'post-type-selector', 'pts-nonce-select' );
|
| 202 |
+
|
| 203 |
+
$this->select_box();
|
| 204 |
+
|
| 205 |
+
?></label>
|
| 206 |
+
</div>
|
| 207 |
+
|
| 208 |
+
<?php
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
/**
|
| 212 |
+
* Adds quickedit button for bulk-editing post types
|
| 213 |
+
*
|
| 214 |
+
* @since 1.2.0
|
| 215 |
+
*/
|
| 216 |
+
public function quick_edit_bulk( $column_name = '' ) {
|
| 217 |
|
| 218 |
// Bail to prevent multiple dropdowns in each column
|
| 219 |
if ( 'post_type' !== $column_name ) {
|
| 220 |
return;
|
| 221 |
} ?>
|
| 222 |
|
| 223 |
+
<label id="pts_bulk_edit" class="alignleft">
|
| 224 |
+
<span class="title"><?php esc_html_e( 'Post Type', 'post-type-switcher' ); ?></span><?php
|
|
|
|
|
|
|
| 225 |
|
| 226 |
+
wp_nonce_field( 'post-type-selector', 'pts-nonce-select' );
|
| 227 |
|
| 228 |
+
$this->select_box( true );
|
| 229 |
|
| 230 |
+
?></label>
|
|
|
|
|
|
|
| 231 |
|
| 232 |
<?php
|
| 233 |
}
|
| 237 |
*
|
| 238 |
* @since 1.2
|
| 239 |
*/
|
| 240 |
+
public function quick_edit_script( $hook = '' ) {
|
| 241 |
|
| 242 |
+
// Bail if not edit.php admin page
|
| 243 |
if ( 'edit.php' !== $hook ) {
|
| 244 |
return;
|
| 245 |
}
|
| 246 |
|
| 247 |
+
// Enqueue quick edit JS
|
| 248 |
+
wp_enqueue_script( 'pts_quickedit', plugin_dir_url( __FILE__ ) . 'assets/js/quickedit.js', array( 'jquery' ), $this->asset_version, true );
|
| 249 |
}
|
| 250 |
|
| 251 |
/**
|
| 253 |
*
|
| 254 |
* @since 1.2
|
| 255 |
*/
|
| 256 |
+
public function select_box( $bulk = false ) {
|
| 257 |
+
|
| 258 |
+
// Get post type specific data
|
| 259 |
+
$args = $this->get_post_type_args();
|
| 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 |
+
|
| 272 |
+
// Output
|
| 273 |
?><select name="pts_post_type" id="pts_post_type"><?php
|
| 274 |
|
| 275 |
+
// Maybe include "No Change" option for bulk
|
| 276 |
+
if ( true === $bulk ) :
|
| 277 |
+
?><option value="-1"><?php esc_html_e( '— No Change —', 'post-type-switcher' ); ?></option><?php
|
| 278 |
+
endif;
|
| 279 |
+
|
| 280 |
+
// Loop through post types
|
| 281 |
foreach ( $post_types as $_post_type => $pt ) :
|
| 282 |
|
| 283 |
+
// Skip if user cannot publish this type of post
|
| 284 |
if ( ! current_user_can( $pt->cap->publish_posts ) ) :
|
| 285 |
continue;
|
| 286 |
endif;
|
| 287 |
|
| 288 |
+
// Only select if not bulk
|
| 289 |
+
if ( false === $bulk ) :
|
| 290 |
+
$selected = selected( $post_type, $_post_type );
|
| 291 |
+
endif;
|
| 292 |
+
|
| 293 |
+
// Output option
|
| 294 |
+
?><option value="<?php echo esc_attr( $pt->name ); ?>" <?php echo $selected; // Do not escape ?>><?php echo esc_html( $pt->labels->singular_name ); ?></option><?php
|
| 295 |
|
| 296 |
endforeach;
|
| 297 |
|
| 298 |
?></select><?php
|
| 299 |
|
| 300 |
+
// Output the current buffer
|
| 301 |
+
echo ob_get_clean();
|
| 302 |
}
|
| 303 |
|
| 304 |
/**
|
| 329 |
return $data;
|
| 330 |
}
|
| 331 |
|
| 332 |
+
// Bail if no specific post ID is being saved
|
| 333 |
+
if ( empty( $postarr['post_ID'] ) ) {
|
| 334 |
+
return $data;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
// Post type information
|
| 338 |
+
$post_id = absint( $postarr['post_ID'] );
|
| 339 |
$post_type = sanitize_key( $_REQUEST['pts_post_type'] );
|
| 340 |
$post_type_object = get_post_type_object( $post_type );
|
| 341 |
|
| 342 |
// Bail if empty post type
|
| 343 |
+
if ( empty( $post_id ) || empty( $post_type ) || empty( $post_type_object ) ) {
|
| 344 |
+
return $data;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
// Bail if no change
|
| 348 |
+
if ( $post_type === $data['post_type'] ) {
|
| 349 |
return $data;
|
| 350 |
}
|
| 351 |
|
| 352 |
+
// Bail if posted ID to update does not match the post ID being changed.
|
| 353 |
+
// This is to prevent child posts (or related) from also being changed.
|
| 354 |
+
// See: https://github.com/JJJ/post-type-switcher/issues/9
|
| 355 |
+
if ( $post_id !== $postarr['ID'] ) {
|
| 356 |
+
return $data;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
// Bail if user cannot 'edit_post' on the current post ID
|
| 360 |
if ( ! current_user_can( 'edit_post', $postarr['ID'] ) ) {
|
| 361 |
return $data;
|
| 362 |
}
|
| 363 |
|
| 364 |
+
// Bail if user cannot 'publish_posts' on the new type
|
| 365 |
+
if ( ! current_user_can( $post_type_object->cap->publish_posts ) ) {
|
| 366 |
+
return $data;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
// Bail if nonce is invalid
|
| 370 |
if ( ! wp_verify_nonce( $_REQUEST['pts-nonce-select'], 'post-type-selector' ) ) {
|
| 371 |
return $data;
|
| 386 |
return $data;
|
| 387 |
}
|
| 388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
// Update post type
|
| 390 |
$data['post_type'] = $post_type;
|
| 391 |
|
| 425 |
});
|
| 426 |
</script>
|
| 427 |
<style type="text/css">
|
| 428 |
+
#wpbody-content .inline-edit-row .inline-edit-col-right .alignleft + .alignleft {
|
| 429 |
+
float: right;
|
| 430 |
+
}
|
| 431 |
#post-type-select {
|
| 432 |
line-height: 2.5em;
|
| 433 |
margin-top: 3px;
|
readme.txt
CHANGED
|
@@ -1,24 +1,29 @@
|
|
| 1 |
=== Post Type Switcher ===
|
| 2 |
Contributors: johnjamesjacoby, beatpanda, norcross, stuttter
|
| 3 |
-
Tags: post type
|
| 4 |
Requires at least: 3.0
|
| 5 |
-
Tested up to: 4.
|
| 6 |
-
Stable tag:
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
A simple way to change a post's type in WordPress
|
| 9 |
|
| 10 |
== Description ==
|
| 11 |
|
| 12 |
-
This plugin adds a simple post
|
| 13 |
|
| 14 |
= Supported Types =
|
| 15 |
|
| 16 |
-
The plugin can convert nearly every combination of posts, pages,
|
| 17 |
|
| 18 |
* Page to Post
|
| 19 |
* Post to Page
|
| 20 |
-
* Page to Attachment
|
| 21 |
* Post to Custom
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
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.
|
| 24 |
|
|
@@ -30,7 +35,7 @@ With bulk editing, thanks to Matthew Gerring, you can select all the posts in a
|
|
| 30 |
|
| 31 |
= Installation =
|
| 32 |
1. In your WordPress Dashboard go to "Plugins" -> "Add Plugin".
|
| 33 |
-
2. Search for "Post Type
|
| 34 |
3. Install the plugin by pressing the "Install" button.
|
| 35 |
4. Activate the plugin by pressing the "Activate" button.
|
| 36 |
5. From the post edit screen, above the "Publish" button is the "Post Type" interface.
|
|
@@ -43,8 +48,8 @@ With bulk editing, thanks to Matthew Gerring, you can select all the posts in a
|
|
| 43 |
|
| 44 |
= Recommended Requirements =
|
| 45 |
* Latest WordPress version.
|
| 46 |
-
* PHP version
|
| 47 |
-
* MySQL version 5.
|
| 48 |
|
| 49 |
== Frequently Asked Questions ==
|
| 50 |
|
|
@@ -61,19 +66,27 @@ It should not. This plugin only changes the 'post_type' property of a post.
|
|
| 61 |
|
| 62 |
== Changelog ==
|
| 63 |
|
| 64 |
-
=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
* Ensure quick-edit works with new procedure
|
| 66 |
* Quick-edit "Type" column works again!
|
| 67 |
|
| 68 |
-
=
|
| 69 |
* Improved plugin compatibility with WooThemes Sensei
|
| 70 |
* Filter post arguments vs. hook to save_post
|
| 71 |
* Add "post_type_switcher" action
|
| 72 |
|
| 73 |
-
=
|
| 74 |
* Add support for network activation
|
| 75 |
|
| 76 |
-
=
|
| 77 |
* Add textdomains for localization
|
| 78 |
* Load translation strings using load_plugin_textdomain()
|
| 79 |
* Before saving data chack if it's not an autosave using wp_is_post_autosave()
|
|
@@ -82,44 +95,44 @@ It should not. This plugin only changes the 'post_type' property of a post.
|
|
| 82 |
* Security: Translation strings escaping
|
| 83 |
* Add screenshots
|
| 84 |
|
| 85 |
-
=
|
| 86 |
* Fix multiple quickedit dropdowns
|
| 87 |
|
| 88 |
-
=
|
| 89 |
* Improve handling of non-public post types
|
| 90 |
|
| 91 |
-
=
|
| 92 |
* Fix saving of autodrafts
|
| 93 |
|
| 94 |
-
=
|
| 95 |
* Improved WordPress 3.9 integration (added dashicon to publish metabox)
|
| 96 |
|
| 97 |
-
=
|
| 98 |
* Add bulk editing to supported post types
|
| 99 |
* Props Matthew Gerring for bulk edit contribution
|
| 100 |
|
| 101 |
-
=
|
| 102 |
* Add is_admin() check to prevent theme-side interference
|
| 103 |
* Change save_post priority to 999 to avoid plugin compatibility issues
|
| 104 |
* Remove ending closing php tag
|
| 105 |
* HTML and PHPDoc improvements
|
| 106 |
|
| 107 |
-
=
|
| 108 |
* Fix revisions being nooped
|
| 109 |
* Fix malformed HTML for some user roles
|
| 110 |
-
*
|
| 111 |
|
| 112 |
-
=
|
| 113 |
* Fix JS bugs
|
| 114 |
* Audit post save bail conditions
|
| 115 |
* Tweak UI for WordPress 3.3
|
| 116 |
|
| 117 |
-
=
|
| 118 |
* Use the API to change the post type, fixing a conflict with persistent object caches
|
| 119 |
* No longer requires JavaScript
|
| 120 |
|
| 121 |
-
=
|
| 122 |
* Disallow post types that are not public and do not have a visible UI
|
| 123 |
|
| 124 |
-
=
|
| 125 |
* Release
|
| 1 |
=== Post Type Switcher ===
|
| 2 |
Contributors: johnjamesjacoby, beatpanda, norcross, stuttter
|
| 3 |
+
Tags: post, page, type, types, post type
|
| 4 |
Requires at least: 3.0
|
| 5 |
+
Tested up to: 4.9
|
| 6 |
+
Stable tag: 3.1.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
|
| 10 |
|
| 11 |
A simple way to change a post's type in WordPress
|
| 12 |
|
| 13 |
== Description ==
|
| 14 |
|
| 15 |
+
This plugin adds a simple post-type drop-down 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.
|
| 16 |
|
| 17 |
= Supported Types =
|
| 18 |
|
| 19 |
+
The plugin can convert nearly every combination of posts, pages, and even custom post types:
|
| 20 |
|
| 21 |
* Page to Post
|
| 22 |
* Post to Page
|
|
|
|
| 23 |
* Post to Custom
|
| 24 |
+
* Custom to Custom
|
| 25 |
+
|
| 26 |
+
As of 3.0.0, support for switching to or from Attachments was removed. This may come back in a subsequent version.
|
| 27 |
|
| 28 |
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.
|
| 29 |
|
| 35 |
|
| 36 |
= Installation =
|
| 37 |
1. In your WordPress Dashboard go to "Plugins" -> "Add Plugin".
|
| 38 |
+
2. Search for "Post Type Switcher".
|
| 39 |
3. Install the plugin by pressing the "Install" button.
|
| 40 |
4. Activate the plugin by pressing the "Activate" button.
|
| 41 |
5. From the post edit screen, above the "Publish" button is the "Post Type" interface.
|
| 48 |
|
| 49 |
= Recommended Requirements =
|
| 50 |
* Latest WordPress version.
|
| 51 |
+
* PHP version 7.0 or greater.
|
| 52 |
+
* MySQL version 5.7 or greater, or MariaDB 10 or greater.
|
| 53 |
|
| 54 |
== Frequently Asked Questions ==
|
| 55 |
|
| 66 |
|
| 67 |
== Changelog ==
|
| 68 |
|
| 69 |
+
= 3.1.0 =
|
| 70 |
+
* Fix post targeting when called recursively
|
| 71 |
+
|
| 72 |
+
= 3.0.0 =
|
| 73 |
+
* Improved Quick-Edit and Bulk-Edit support
|
| 74 |
+
* Remove `attachment` type support for now, as there is no way to switch back
|
| 75 |
+
* Fix bug causing some post-types to switch unexpectedly
|
| 76 |
+
|
| 77 |
+
= 2.0.1 =
|
| 78 |
* Ensure quick-edit works with new procedure
|
| 79 |
* Quick-edit "Type" column works again!
|
| 80 |
|
| 81 |
+
= 2.0.0 =
|
| 82 |
* Improved plugin compatibility with WooThemes Sensei
|
| 83 |
* Filter post arguments vs. hook to save_post
|
| 84 |
* Add "post_type_switcher" action
|
| 85 |
|
| 86 |
+
= 1.7.0 =
|
| 87 |
* Add support for network activation
|
| 88 |
|
| 89 |
+
= 1.6.0 =
|
| 90 |
* Add textdomains for localization
|
| 91 |
* Load translation strings using load_plugin_textdomain()
|
| 92 |
* Before saving data chack if it's not an autosave using wp_is_post_autosave()
|
| 95 |
* Security: Translation strings escaping
|
| 96 |
* Add screenshots
|
| 97 |
|
| 98 |
+
= 1.5.0 - norcross =
|
| 99 |
* Fix multiple quickedit dropdowns
|
| 100 |
|
| 101 |
+
= 1.4.0 =
|
| 102 |
* Improve handling of non-public post types
|
| 103 |
|
| 104 |
+
= 1.3.0 =
|
| 105 |
* Fix saving of autodrafts
|
| 106 |
|
| 107 |
+
= 1.2.1 =
|
| 108 |
* Improved WordPress 3.9 integration (added dashicon to publish metabox)
|
| 109 |
|
| 110 |
+
= 1.2.0 =
|
| 111 |
* Add bulk editing to supported post types
|
| 112 |
* Props Matthew Gerring for bulk edit contribution
|
| 113 |
|
| 114 |
+
= 1.1.1 =
|
| 115 |
* Add is_admin() check to prevent theme-side interference
|
| 116 |
* Change save_post priority to 999 to avoid plugin compatibility issues
|
| 117 |
* Remove ending closing php tag
|
| 118 |
* HTML and PHPDoc improvements
|
| 119 |
|
| 120 |
+
= 1.1.0 =
|
| 121 |
* Fix revisions being nooped
|
| 122 |
* Fix malformed HTML for some user roles
|
| 123 |
+
* Make a singleton (meh...)
|
| 124 |
|
| 125 |
+
= 1.0.0 =
|
| 126 |
* Fix JS bugs
|
| 127 |
* Audit post save bail conditions
|
| 128 |
* Tweak UI for WordPress 3.3
|
| 129 |
|
| 130 |
+
= 0.3.0 =
|
| 131 |
* Use the API to change the post type, fixing a conflict with persistent object caches
|
| 132 |
* No longer requires JavaScript
|
| 133 |
|
| 134 |
+
= 0.2.0 =
|
| 135 |
* Disallow post types that are not public and do not have a visible UI
|
| 136 |
|
| 137 |
+
= 0.1.0 =
|
| 138 |
* Release
|
