public
Created

This is a test plugin for resolving https://core.trac.wordpress.org/ticket/15943

  • Download Gist
sandbox-test.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
<?php
/*
* Plugin Name: Local Sandbox Plugin
* Version: 1.0
*/
 
if ( !class_exists( 'Sandbox' ) ) {
 
class Sandbox {
 
# PHP 4 Constructor
function Sandbox() {
 
add_action( 'init' , array( &$this , 'register_custom_post_type' ) );
add_action( 'template_redirect' , array( &$this , 'what_is_wp_query' ) );
 
} # End sandbox()
 
function what_is_wp_query() {
global $wp_query;
 
echo '<pre>' . print_r( $wp_query , true ) . '</pre>';
 
}
 
# Register new post type for acme_product.
function register_custom_post_type() {
 
register_post_type(
'acme_product',
array(
'labels' => array(
'name' => 'Acme Products',
),
'public' => true,
'publicly_queryable' => true,
'show_in_nav_menus' => false,
'exclude_from_search' => false,
'show_ui' => true,
'hierarchical' => false,
'rewrite' => array(
'slug' => 'acme_product',
'with_front' => false
),
'query_var' => 'acme_product',
'supports' => array(
'title',
'editor',
'thumbnail',
'comments',
'revisions'
)
)
);
} # End reigster_custom_post_type()
} # End Class
} # End Class Check
 
# Create a new instance of the plugin so that it's ready for use.
if ( class_exists( 'Sandbox' ) and !isset( $sandbox ) ) {
$sandbox = new Sandbox();
}
 
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.