to make an area like in the picture for what kind of change should I make below
<?php
/* Portfolio Custom Post Type */
$args = array(
"label" => "Şarkı Sözü",
"singular_label" => "Şarkı Sözü Kategorisi",
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => true,
'query_var' => true
);
add_action('init', 'Theme2035_lyric_register');
function Theme2035_lyric_register() {
global $theme_prefix;
if(empty($theme_prefix['lyrics-page-slug'])) { $theme_prefix['lyrics-page-slug'] = "lyrics"; }
$lyric_slug = $theme_prefix['lyrics-page-slug'];
$labels = array(
'add_new' => __('Yeni Şarkı Ekle', 'portfolio item', "2035Themes-fm"),
'name' => __('Şarkı sözleri', 'post type general name', "2035Themes-fm"),
'singular_name' => __('Şarkı sözleri', 'post type singular name', "2035Themes-fm"),
'add_new_item' => __('Yeni Şarkı Sözü Ekleme', "2035Themes-fm"),
'edit_item' => __('Şarkı Sözünü Düzenle!', "2035Themes-fm"),
'new_item' => __('Yeni Şarkı Sözü', "2035Themes-fm"),
'view_item' => __('Şarkı Sözünü Görüntüle', "2035Themes-fm"),
'search_items' => __('Şarkı Sözü Ara', "2035Themes-fm"),
'not_found' => __('Henüz hiçbir Şarkı eklenmedi', "2035Themes-fm"),
'not_found_in_trash' => __('Çöpte hiçbir şey bulunamadı', "2035Themes-fm"),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'rewrite' => array( 'slug' => $lyric_slug, 'with_front' => false ),
'supports' => array('title', 'editor','thumbnail','comments'),
'has_archive' => true,
'taxonomies' => array('post_tag'),
'menu_icon' => 'dashicons-format-audio',
);
register_post_type( 'lyrics' , $args );
}
?>
I want to add feature album and artist
array(
'name' => __( 'Sanatçı adı', 'Theme2035Framework' ),
'id' => $prefix."artist_name",
'type' => 'select_advanced',
'options' => $artist_list,
'multiple' => false,
'placeholder' => __( 'Sanatçı İsmini Seç', 'Theme2035Framework' ),
),
array(
'name' => __( 'Albüm Adı', 'Theme2035Framework' ),
'id' => $prefix."album_name",
'type' => 'select_advanced',
'options' => $album_list,
'multiple' => false,
'placeholder' => __( 'Albüm Adını Seç', 'Theme2035Framework' ),
)
.jpg
to make an area like in the picture for what kind of change should I make below
<?php
/* Portfolio Custom Post Type */
$args = array(
"label" => "Şarkı Sözü",
"singular_label" => "Şarkı Sözü Kategorisi",
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => true,
'query_var' => true
);
add_action('init', 'Theme2035_lyric_register');
function Theme2035_lyric_register() {
global $theme_prefix;
if(empty($theme_prefix['lyrics-page-slug'])) { $theme_prefix['lyrics-page-slug'] = "lyrics"; }
$lyric_slug = $theme_prefix['lyrics-page-slug'];
$labels = array(
'add_new' => __('Yeni Şarkı Ekle', 'portfolio item', "2035Themes-fm"),
'name' => __('Şarkı sözleri', 'post type general name', "2035Themes-fm"),
'singular_name' => __('Şarkı sözleri', 'post type singular name', "2035Themes-fm"),
'add_new_item' => __('Yeni Şarkı Sözü Ekleme', "2035Themes-fm"),
'edit_item' => __('Şarkı Sözünü Düzenle!', "2035Themes-fm"),
'new_item' => __('Yeni Şarkı Sözü', "2035Themes-fm"),
'view_item' => __('Şarkı Sözünü Görüntüle', "2035Themes-fm"),
'search_items' => __('Şarkı Sözü Ara', "2035Themes-fm"),
'not_found' => __('Henüz hiçbir Şarkı eklenmedi', "2035Themes-fm"),
'not_found_in_trash' => __('Çöpte hiçbir şey bulunamadı', "2035Themes-fm"),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'rewrite' => array( 'slug' => $lyric_slug, 'with_front' => false ),
'supports' => array('title', 'editor','thumbnail','comments'),
'has_archive' => true,
'taxonomies' => array('post_tag'),
'menu_icon' => 'dashicons-format-audio',
);
register_post_type( 'lyrics' , $args );
}
?>
I want to add feature album and artist
array(
'name' => __( 'Sanatçı adı', 'Theme2035Framework' ),
'id' => $prefix."artist_name",
'type' => 'select_advanced',
'options' => $artist_list,
'multiple' => false,
'placeholder' => __( 'Sanatçı İsmini Seç', 'Theme2035Framework' ),
),
array(
'name' => __( 'Albüm Adı', 'Theme2035Framework' ),
'id' => $prefix."album_name",
'type' => 'select_advanced',
'options' => $album_list,
'multiple' => false,
'placeholder' => __( 'Albüm Adını Seç', 'Theme2035Framework' ),
)
https://cdn.r10/editor/31364/7ff22d5e9cd73d600c26021f87612d66.jpg
Share Improve this question edited Jun 13, 2019 at 11:26 Matthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges asked May 9, 2019 at 22:37 Fırat YamanFırat Yaman 112 bronze badges 2- 1 Avoid placing the code on external servers, from where it can disappear later, edit question and paste it here. Please translate labels so that the pasted code is more readable. – nmr Commented May 10, 2019 at 8:31
- 1 Look into register_taxonomy – Faham Shaikh Commented Jun 13, 2019 at 11:29
1 Answer
Reset to default 0What you are looking for is custom taxonomy (which has been mentioned in the comments). Which you create with the register_taxonomy()
function. There is a beginners guide here if you need it.
You will need to pass in an array of arguments. The most important is probably hierarchical
which is true for something like categories, or false for something like tags.
<?php
$object_type = 'lyrics'; // this can be any type including post, page, etc..
$taxonomy = 'my_featured_artists'; // this could be whatever you want it to be
$args = array();
$args['hierarchical']=TRUE; // this is probably what you are looking for.
register_taxonomy( $taxonomy, $object_type, $args );
I found a specific example of a taxonomy for music here. Give it a go and if you run into any specific problems you can always come back and ask more specific questions.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745405442a4626292.html
评论列表(0条)