Postdị Omenala Post na withdị omenala

wordpress

WordPress na-aghọ ụdị ikpo okwu dị mkpa nye ọtụtụ ụlọ ọrụ, mana ụlọ ọrụ nkezi anaghịdị eji akụkụ nke ike. Otu n'ime ndị ahịa anyị chọrọ ịtinye ngalaba akụ na saịtị ha mana ọ chọghị iji ya mee peeji ma ọ bụ na blọọgụ. Nke a bụ kpọmkwem ihe WordPress na-akwado Omenala Post Types n'ihi na!

N'okwu a, anyị chọrọ itinye Ngalaba Akụ na otu n'ime saịtị ndị ahịa anyị. Ọ dị mfe ịtinye Omenala Post Type gaa na isiokwu WordPress gị. Gbakwunye koodu na-esonụ site na iji ọrụ ahụ aha_post_type ka gị function.php peeji nke:

// Tinye Resources Custom Post Type add_action ('init', 'create_post_type'); function create_post_type () {register_post_type ('resources', array ('labels' => array ('name' => __ ('Resources'), 'singular_name' => __ ('Resource'), 'add_new' => __)) ('Tinye ihe ọhụrụ'), 'add_new_item' => __ ('Tinye ihe omuma ohuru'), 'edit_item' => __ ('Dezie Akuko'), 'new_item' => __ ('New Resource'), 'all_items' => __ ('All Resources'), 'view_item' => __ ('View Resource'), 'search_items' => __ ('Search Resources'), 'not_found' => __ ('Agaghị Achọpụta Ihe'), 'not_found_in_trash' => __ ('Enweghị ihe enyemaka na ahịhịa'), 'parent_item_colon' => '', 'menu_name' => __ ('Resources')), 'public' => ezi, 'has_archive' => true, 'rewrite' => array ('slug' => 'resources'), 'na-akwado' => array ('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'))) ; }

Obere ihe siri ike ịchọta bụ otu esi eme omenala edemede n'ihi na gị Omenala Post Type. Otu ihe kpatara na o siri ike ịchọpụta otu esi eme nke a bụ n'ihi na a na-akpọ ya taxonomy omenala ma jiri ya debanye aha_taxonomy ọrụ iji hazie ya. N'okwu a, anyị chọrọ itinye ụdị akụ dị ka Webinars, Whitepapers, wdg na isiokwu… yabụ lee ụfọdụ koodu maka faịlụ function.php:

add_action ('init', 'resource_category_init', 100); // 100 yabụ edebanyela ụdị post post ọrụ__galaba_init () {register_taxonomy ('type', 'resources', array ('labels' => array ('name' => 'Resource Type', 'singular_name' => ' Resource Type ',' search_items '=>' Search Resource Types ',' popular_items '=>' Popular Resource Types ',' all_items '=>' All Resource Types ',' edit_item '=> __ (' Dezie Akụ'dị ') , 'update_item' => __ ('Mmelite Resource Type'), 'add_new_item' => __ ('Tinye Resodị Ngwakọta Ọhụrụ'), 'new_item_name' => __ ('New Resource Type')), 'hierarchical' => 'ụgha', 'labeelu' => 'Typedị Isi')); }

Omenala Post Types na-enye gị ohere ịhazi ebe nchekwa na otu ibe maka ụdị Post Post gị. Naanị detuo faịlụ archive.php na single.php. Kpọgharia aha akwụkwọ ndị ahụ na Omenala Post Type n'aha. N'okwu a, nke ahụ ga-abụ archive-resources.php na single-resources.php. Ugbu a ị nwere ike hazie ibe ndị ahụ agbanyeghị na ịchọrọ ka ibe akụ ga-ele anya.

2 Comments

  1. 1

    Zọ ọzọ ga - abụ iji ngwa mgbakwunye dị ka Easydị Ọdịnaya Ntọala Omenala ma ọ bụ Tydị.

    Ngwa ndị a na - enyere gị aka itinye igbe meta meta ọfụma ma mepụta ihu akwụkwọ na post ndebiri.

    • 2

      Ezigbo eziokwu @ google-d5279c8b66d25549a0ec3c8dd46a3d1a: disqus! M ga-eme ihe n'eziokwu na ọ dị m ka otu n'ime plugins na-agbakwunye ụda nke blọọgụ… ma ị nweghị ike ịkwaga otu isiokwu site na saịtị gaa na nke ọzọ, ị ga-ahụrịrị na ị na-ebugharị plugins, kwa . Ọ bụ naanị ihe kpatara m ji arụ ọrụ iji tinye ọrụ ndị dị mkpa na faịlụ isiokwu.

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.