Created
November 28, 2013 02:30
-
-
Save Danjavia/7686432 to your computer and use it in GitHub Desktop.
use to create postypes is necessary revision
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$functions_file = 'postypes.php'; | |
$names = array( 'Photos', 'Gallery', 'Catalog' ); | |
$function = ' | |
<?php | |
function pulsar_postypes() { | |
'; | |
file_put_contents( ABS_PATH . 'templates/' . $functions_file, $function ); | |
foreach ($names as $name) { | |
file_get_contents( ABS_PATH . 'templates/' . $functions_file ); | |
$function .= " | |
/** | |
* " . $name . " PostType | |
*/ | |
\$labels = array( | |
'name' => _x( '" . $name . "', 'post type general name' ), | |
'singular_name' => _x( '" . $name . " Item', 'post type singular name' ), | |
'add_new' => _x( 'Add New " . $name . " Item', '" . $name . " Item' ), | |
'add_new_item' => __( 'Add New " . $name . " Item' ), | |
'edit_item' => __( 'Edit " . $name . " Item' ), | |
'new_item' => __( 'New " . $name . " Item' ), | |
'all_items' => __( 'All " . $name . "' ), | |
'view_item' => __( 'View " . $name . " Item' ), | |
'search_items' => __( 'Search " . $name . "' ), | |
'not_found' => __( 'No " . $name . " found' ), | |
'not_found_in_trash' => __( 'No " . $name . " found in the Trash' ), | |
'parent_item_colon' => '', | |
'menu_name' => '" . $name . "' | |
); | |
\$args = array( | |
'labels' => \$labels, | |
'description' => 'Create and publish each " . $name . " from your projects', | |
'public' => true, | |
'menu_position' => 10, | |
'supports' => array( 'title', 'slug', 'thumbnail', 'excerpt', 'custom-fields', 'page-attributes', 'comments', 'post-formats' ), | |
'has_archive' => true, | |
); | |
register_post_type( '" . $name . "', \$args ); | |
"; | |
file_put_contents( ABS_PATH . 'templates/' . $functions_file, $function ); | |
} | |
$function .= " | |
} | |
add_action( 'init', 'pulsar_postypes' ); | |
"; | |
file_put_contents( ABS_PATH . 'templates/' . $functions_file, $function ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment