Created
December 20, 2013 09:48
-
-
Save qholzweg/8052605 to your computer and use it in GitHub Desktop.
wordpress register
This file contains hidden or 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 | |
function my_scripts_method() { | |
wp_enqueue_style( | |
'foundation', | |
get_stylesheet_directory_uri() . '/ct/stylesheets/app.css', | |
array(), | |
false, | |
'all' | |
); | |
wp_enqueue_script( 'jquery.cycle' | |
, get_bloginfo('stylesheet_directory').'/scripts/jquery.cycle.all.min.js', array('jquery')); | |
} | |
add_action('wp_enqueue_scripts', 'my_scripts_method'); | |
register_post_type( 'banner', array( | |
'labels' => array( | |
'name' => __( 'Banners' ), | |
'singular_name' => __( 'Banner' ), | |
'add_new' => __( 'Add New' ), | |
'add_new_item' => __( 'Add New Banner' ), | |
'edit_item' => __( 'Edit Banner' ), | |
'new_item' => __( 'New Banner' ), | |
'view_item' => __( 'View Banner' ), | |
'search_items' => __( 'Search Banners' ), | |
'not_found' => __( 'No banners found' ), | |
'not_found_in_trash' => __( 'No banners found in Trash' ), | |
'parent_item_colon' => __( 'Parent Banner:' ), | |
'menu_name' => __( 'Banners' ) | |
), | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'banner' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'menu_icon' => null, | |
'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), | |
'taxonomies' => array( 'categories', 'post_tags' ) | |
) ); | |
// hook into the init action and call create_book_taxonomies when it fires | |
add_action( 'init', 'create_book_taxonomies', 0 ); | |
// create two taxonomies, genres and writers for the post type "book" | |
function create_book_taxonomies() { | |
// Add new taxonomy, make it hierarchical (like categories) | |
$labels = array( | |
'name' => _x( 'Genres', 'taxonomy general name' ), | |
'singular_name' => _x( 'Genre', 'taxonomy singular name' ), | |
'search_items' => __( 'Search Genres' ), | |
'all_items' => __( 'All Genres' ), | |
'parent_item' => __( 'Parent Genre' ), | |
'parent_item_colon' => __( 'Parent Genre:' ), | |
'edit_item' => __( 'Edit Genre' ), | |
'update_item' => __( 'Update Genre' ), | |
'add_new_item' => __( 'Add New Genre' ), | |
'new_item_name' => __( 'New Genre Name' ), | |
'menu_name' => __( 'Genre' ), | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'genre' ), | |
); | |
register_taxonomy( 'genre', array( 'book' ), $args ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment