-
-
Save dn7734/827d73b39380966f99da0de2778d88c6 to your computer and use it in GitHub Desktop.
Custom post type function.php
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
// Register Custom Post Type portfolio | |
if ( ! function_exists('portfolios_post_type') ) { | |
function portfolios_post_type() { | |
$labels = array( | |
'name' => _x( 'Замовники', 'Post Type General Name', 'text_domain' ), | |
'singular_name' => _x( 'Замовники', 'Post Type Singular Name', 'text_domain' ), | |
'menu_name' => __( 'Замовники', 'text_domain' ), | |
'name_admin_bar' => __( 'Замовники', 'text_domain' ), | |
'archives' => __( 'Замовники', 'text_domain' ), | |
'parent_item_colon' => __( 'Parent Замовники:', 'text_domain' ), | |
'all_items' => __( 'Всі Замовники', 'text_domain' ), | |
'add_new_item' => __( 'Створити Замовників', 'text_domain' ), | |
'add_new' => __( 'Створити', 'text_domain' ), | |
'new_item' => __( 'Нові Замовники', 'text_domain' ), | |
'edit_item' => __( 'Редагувати Замовників', 'text_domain' ), | |
'update_item' => __( 'Оновити Замовників', 'text_domain' ), | |
'view_item' => __( 'Переглянути Замовників', 'text_domain' ), | |
'search_items' => __( 'Шукати Замовників', 'text_domain' ), | |
'not_found' => __( 'Not found', 'text_domain' ), | |
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), | |
'featured_image' => __( 'Зображення', 'text_domain' ), | |
'set_featured_image' => __( 'Встановити головне зображення', 'text_domain' ), | |
'remove_featured_image' => __( 'Видалити головне зображення', 'text_domain' ), | |
'use_featured_image' => __( 'Use as featured image', 'text_domain' ), | |
'insert_into_item' => __( 'Insert into item', 'text_domain' ), | |
'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ), | |
'items_list' => __( 'Items list', 'text_domain' ), | |
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ), | |
'filter_items_list' => __( 'Filter items list', 'text_domain' ), | |
); | |
$rewrite = array( | |
'slug' => 'silrada', | |
'with_front' => true, | |
'pages' => true, | |
'feeds' => true, | |
); | |
$args = array( | |
'label' => __( 'portfolio', 'text_domain' ), | |
'description' => __( 'Post Type Description', 'text_domain' ), | |
'labels' => $labels, | |
'taxonomies' => array( 'portfolio_cat', 'portfolios_tag' ), | |
'hierarchical' => false, | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', ), | |
'menu_position' => 6, | |
'menu_icon' => 'dashicons-format-image', | |
'show_in_admin_bar' => true, | |
'show_in_nav_menus' => true, | |
'can_export' => true, | |
'has_archive' => true, | |
'exclude_from_search' => false, | |
'publicly_queryable' => true, | |
'rewrite' => $rewrite, | |
'capability_type' => 'page', | |
); | |
register_post_type( 'portfolio', $args ); | |
} | |
add_action( 'init', 'portfolios_post_type', 0 ); | |
} | |
// регистрируем таксономию 'portfolio_cat' | |
function wptp_register_taxonomy() { | |
register_taxonomy( 'portfolio_cat', 'portfolio', | |
array( | |
'labels' => array( | |
'name' => 'Сільрада Categories', | |
'singular_name' => 'Сільрада Categories', | |
'search_items' => 'Шукати Сільрада Categories', | |
'edit_item' => 'Правити Сільрада Categories', | |
'update_item' => 'Оновити Сільрада Categories', | |
'all_items' => __( 'Всі Сільради', 'text_domain' ), | |
'add_new_item' => __( 'Створити Сільраду', 'text_domain' ), | |
'add_new' => __( 'Створити', 'text_domain' ), | |
'menu_name' => 'Сільради', | |
), | |
'hierarchical' => true, | |
'sort' => true, | |
'args' => array( 'orderby' => 'term_order' ), | |
'rewrite' => array( 'slug' => 'portfolio_cat' ), | |
'show_admin_column' => true | |
) | |
); | |
} | |
add_action( 'init', 'wptp_register_taxonomy' ); | |
// регистрируем таксономию 'portfolio_skills' | |
function skills_register_taxonomy() { | |
register_taxonomy( 'portfolio_skills', 'portfolio', | |
array( | |
'labels' => array( | |
'name' => 'Сільрада дизайн', | |
'singular_name' => 'Сільрада дизайн', | |
'search_items' => 'Шукати Сільрада дизайн', | |
'edit_item' => 'Правити Сільрада дизайни', | |
'update_item' => 'Оновити Сільрада дизайни', | |
'all_items' => __( 'Всі дизайни Сільрад', 'text_domain' ), | |
'add_new_item' => __( 'Створити дизайн Сільради', 'text_domain' ), | |
'add_new' => __( 'Створити дизайн', 'text_domain' ), | |
'menu_name' => 'Сільради дизайни', | |
), | |
'hierarchical' => true, | |
'sort' => true, | |
'args' => array( 'orderby' => 'term_order' ), | |
'rewrite' => array( 'slug' => 'portfolio_skills' ), | |
'show_admin_column' => true | |
) | |
); | |
} | |
add_action( 'init', 'skills_register_taxonomy' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment