Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // =============================
- // custom taxonomies (cats and tags)
- // =============================
- function custom_taxonomy() {
- $labels = array(
- 'name' => _x( 'ifcc Categories', 'Taxonomy General Name', 'text_domain' ),
- 'singular_name' => _x( 'ifcc Category', 'Taxonomy Singular Name', 'text_domain' ),
- 'menu_name' => __( 'ifcc category', 'text_domain' ),
- 'all_items' => __( 'All Items', 'text_domain' ),
- 'parent_item' => __( 'Parent Item', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
- 'new_item_name' => __( 'New Item Name', 'text_domain' ),
- 'add_new_item' => __( 'Add New Item', 'text_domain' ),
- 'edit_item' => __( 'Edit Item', 'text_domain' ),
- 'update_item' => __( 'Update Item', 'text_domain' ),
- 'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
- 'search_items' => __( 'Search Items', 'text_domain' ),
- 'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ),
- 'choose_from_most_used' => __( 'Choose from the most used items', 'text_domain' ),
- 'not_found' => __( 'Not Found', 'text_domain' ),
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => true,
- 'public' => true,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- 'rewrite' => array( 'slug' => 'ifcc-categories' ),
- 'query_var' => true
- );
- register_taxonomy( 'ifcc_cats', array( 'ifcc' ), $args );
- $labels = array(
- 'name' => _x( 'Tags', 'Taxonomy General Name', 'text_domain' ),
- 'singular_name' => _x( 'Tag', 'Taxonomy Singular Name', 'text_domain' ),
- 'menu_name' => __( 'Tag', 'text_domain' ),
- 'all_items' => __( 'All Items', 'text_domain' ),
- 'parent_item' => __( 'Parent Item', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
- 'new_item_name' => __( 'New Item Name', 'text_domain' ),
- 'add_new_item' => __( 'Add New Item', 'text_domain' ),
- 'edit_item' => __( 'Edit Item', 'text_domain' ),
- 'update_item' => __( 'Update Item', 'text_domain' ),
- 'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
- 'search_items' => __( 'Search Items', 'text_domain' ),
- 'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ),
- 'choose_from_most_used' => __( 'Choose from the most used items', 'text_domain' ),
- 'not_found' => __( 'Not Found', 'text_domain' ),
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- 'query_var' => true
- );
- register_taxonomy( 'ifcc_tags', array( 'ifcc' ), $args );
- }
- add_action( 'init', 'custom_taxonomy', 20 );
- // =============================
- // register ifcc custom post type for new tax up
- // =============================
- function custom_post_type() {
- global $woo_contest;
- $labels = array(
- 'name' => _x( 'IFCC Submits', 'Post Type General Name', 'text_domain' ),
- 'singular_name' => _x( 'IFCC Submit', 'Post Type Singular Name', 'text_domain' ),
- 'menu_name' => __( 'IFCC Submit', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
- 'all_items' => __( 'All Items', 'text_domain' ),
- 'view_item' => __( 'View Item', 'text_domain' ),
- 'add_new_item' => __( 'Add New Item', 'text_domain' ),
- 'add_new' => __( 'Add New', 'text_domain' ),
- 'edit_item' => __( 'Edit Item', 'text_domain' ),
- 'update_item' => __( 'Update Item', 'text_domain' ),
- 'search_items' => __( 'Search Item', 'text_domain' ),
- 'not_found' => __( 'Not found', 'text_domain' ),
- 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
- );
- $args = array(
- 'label' => __( 'post_type', 'text_domain' ),
- 'description' => __( 'ifcc submit', 'text_domain' ),
- 'labels' => $labels,
- 'supports' => array( 'title', 'editor', 'revisions', 'custom-fields', 'post-formats', 'author', 'thumbnail' ),
- 'taxonomies' => array( 'ifcc_cats', 'ifcc_tags' ),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'show_in_nav_menus' => true,
- 'show_in_admin_bar' => true,
- 'menu_position' => 20,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => true,
- 'publicly_queryable' => true,
- 'capability_type' => 'ifcc',
- 'capabilities' => array( 'read_ifcc', 'edit_ifcc', 'delete_ifcc' ),
- 'map_meta_cap' => true
- );
- register_post_type( 'ifcc', $args );
- register_taxonomy_for_object_type( 'ifcc_cats', 'ifcc' );
- register_taxonomy_for_object_type( 'ifcc_tags', 'ifcc' );
- // flush_rewrite_rules();
- if( $woo_contest['block-dashboard'] == '1' ){
- // block non admin users from dashboard!
- if ( is_admin() && ! current_user_can( 'administrator' ) &&
- ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
- wp_redirect( home_url() );
- exit;
- }
- }
- }
- add_action( 'init', 'custom_post_type', 30 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement