Post Type Switcher - Version 0.2

Version Description

Download this release

Release Info

Developer johnjamesjacoby
Plugin Icon 128x128 Post Type Switcher
Version 0.2
Comparing to
See all releases

Code changes from version 0.1 to 0.2

Files changed (2) hide show
  1. post-type-switcher.php +14 -2
  2. readme.txt +8 -5
post-type-switcher.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Post Type Switcher
4
  Plugin URI: http://wordpress.org
5
  Description: Allow switching of post_type in post publish area
6
  Author: John James Jacoby
7
- Version: 0.1
8
  Author URI: http://johnjamesjacoby.com
9
  */
10
 
@@ -18,9 +18,21 @@ Author URI: http://johnjamesjacoby.com
18
  function pts_metabox() {
19
  global $post;
20
 
21
- $post_types = get_post_types();
 
 
 
 
 
 
 
 
 
 
22
  $cur_post_type = $post->post_type;
23
  $cur_post_type_object = get_post_type_object( $cur_post_type );
 
 
24
  $can_publish = current_user_can( $cur_post_type_object->cap->publish_posts );
25
  ?>
26
 
4
  Plugin URI: http://wordpress.org
5
  Description: Allow switching of post_type in post publish area
6
  Author: John James Jacoby
7
+ Version: 0.2
8
  Author URI: http://johnjamesjacoby.com
9
  */
10
 
18
  function pts_metabox() {
19
  global $post;
20
 
21
+ // Disallows things like attachments, revisions, etc...
22
+ $safe_filter = array( 'public' => true, 'show_ui' => true );
23
+
24
+ // Allow to be filtered, just incase you really need to switch between
25
+ // those crazy types of posts
26
+ $args = apply_filters( 'pts_metabox', $safe_filter );
27
+
28
+ // Get the post types based on the above arguments
29
+ $post_types = get_post_types( (array)$args );
30
+
31
+ // Populate necessary post_type values
32
  $cur_post_type = $post->post_type;
33
  $cur_post_type_object = get_post_type_object( $cur_post_type );
34
+
35
+ // Make sure the currently logged in user has the power
36
  $can_publish = current_user_can( $cur_post_type_object->cap->publish_posts );
37
  ?>
38
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: johnjamesjacoby
3
  Tags: post type
4
  Requires at least: 3.0
5
  Tested up to: 3.0
6
- Stable tag: 0.1
7
 
8
  A simple way to change a post type in WordPress.
9
 
@@ -13,13 +13,16 @@ A simple way to change a post type in WordPress.
13
 
14
  Any combination is possible, even custom post types.
15
 
16
- Page to Post
17
- Post to Page
18
- Page to Attachment
19
- Post to Custom
20
 
21
  == Changelog ==
22
 
 
 
 
23
  = Version 0.1 =
24
  * Release
25
 
3
  Tags: post type
4
  Requires at least: 3.0
5
  Tested up to: 3.0
6
+ Stable tag: 0.2
7
 
8
  A simple way to change a post type in WordPress.
9
 
13
 
14
  Any combination is possible, even custom post types.
15
 
16
+ * Page to Post
17
+ * Post to Page
18
+ * Post to Custom
19
+ * Post to revision/attachment/navigation menu is possible but turned off by default
20
 
21
  == Changelog ==
22
 
23
+ = Version 0.2 =
24
+ * Disallow post types that are not public and do not have a visible UI
25
+
26
  = Version 0.1 =
27
  * Release
28