Izinhlobo Zokuthumela Ngokwezifiso ezinezigaba Ngokwezifiso

wordpress

I-WordPress iba yipulatifomu ebaluleke kakhulu ezinkampanini eziningi, kepha inkampani ejwayelekile ayisebenzisi ngisho nengxenyana yamakhono. Elinye lamakhasimende ethu belifuna ukwengeza isigaba sezinsiza kusayithi labo kepha belingafuni ukukwenza lisebenzisa amakhasi noma kokuthunyelwe kubhulogi. Lokhu yikho kanye okusekelwa yiWordPress Izinhlobo Zokuthumela Ngokwezifiso ngoba!

Kulokhu, besifuna ukungeza isigaba sezinsizakusebenza kwelinye lamasayithi amaklayenti ethu. Kulula ukwengeza ifayela le- Uhlobo Lweposi Ngokwezifiso kutimu yakho ye-WordPress. Ungeza ikhodi elandelayo usebenzisa umsebenzi irejista_post_type ekhasini lakho le-works.php:

// Faka Izinsiza Uhlobo Lokuthunyelwe Ngokwezifiso add_action ('init', 'create_post_type'); function create_post_type () {register_post_type ('resources', array ('labels' => array ('name' => __ ('Resources'), 'singular_name' => __ ('Insiza'), 'add_new' => __ ('Add New'), 'add_new_item' => __ ('Add Resource New'), 'edit_item' => __ ('Hlela Insiza'), 'new_item' => __ ('Imithombo Emisha'), 'all_items' => __ ('Zonke Izinsizakusebenza'), 'view_item' => __ ('Buka Izinsizakusebenza'), 'search_items' => __ ('Izinsiza Zokusesha'), 'not_found' => __ ('Imithombo Engatholakali'), 'not_found_in_trash' => __ ('Azikho Izinsiza Kudoti'), 'parent_item_colon' => '', 'menu_name' => __ ('Resources')), 'public' => iqiniso, 'has_archive' => yiqiniso, 'rewrite' => uhlu ('slug' => 'izinsiza'), 'support' => amalungu afanayo ('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'))) ; }

Okunzima kakhulu ukuthola ukuthi kwenziwa kanjani imikhakha yangokwezifiso ngoba wakho Uhlobo Lweposi Ngokwezifiso. Isizathu esisodwa sokuthi kungani kunzima ukuthola ukuthi ungakwenza kanjani lokhu yingoba ibizwa ngokuthi yi-taxonomy yangokwezifiso futhi isebenzisa indlela ye- register_taxonomy isebenze ngokwezifiso. Kulokhu, sifuna ukwengeza izinhlobo zezinsizakusebenza ezinjengeWebinar, i-Whitepapers, njll kungqikithi… ngakho-ke nayi ikhodi eyengeziwe yefayela le-works.php:

i-add_action ('init', 'resource_category_init', 100); // 100 ngakho-ke uhlobo lokuthunyelwe lubhalisiwe umsebenzi resource_category_init () {register_taxonomy ('type', 'resources', array ('labels' => array ('name' => 'Resource Type', 'singular_name' => ' Uhlobo Lwezinsizakusebenza ',' search_items '=>' Izinhlobo Zezinsiza Zokusesha ',' popular_items '=>' Izinhlobo Zezinsiza Ezidumile ',' all_items '=>' Zonke Izinhlobo Zezinsizakusebenza ',' edit_item '=> __ (' Hlela Izinsiza kusebenza ') , 'update_item' => __ ('Buyekeza Uhlobo Lensiza'), 'add_new_item' => __ ('Faka Uhlobo Lomthombo Omusha'), 'new_item_name' => __ ('Uhlobo Olusha Lwezinsiza')), 'hierarchical' => 'false', 'label' => 'Uhlobo Lensiza')); }

Izinhlobo Zokuposa Ngokwezifiso zikuvumela futhi ukuthi wakhe ingobo yomlando namakhasi awodwa wezinhlobo zakho zeposi langokwezifiso. Vele ukopishe i-archive.php namafayela we-single.php. Qamba kabusha amakhophi nge- Uhlobo Lweposi Ngokwezifiso egameni. Kulokhu, lokho kuzoba yi-archive-resources.php kanye ne-single-resources.php. Manje usungenza ngezifiso lawo makhasi kepha ufisa ukuthi ikhasi lezinsizakusebenza libukeke.

2 Amazwana

  1. 1

    Enye indlela kungaba ukusebenzisa i-plugin efana nezinhlobo ezilula zokuqukethwe ngokwezifiso noma izinhlobo.

    Lawa ma-plugins futhi akwenza ukwazi ukwengeza kalula amabhokisi we-meta wangokwezifiso futhi udale ikhasi langokwezifiso bese uthumela izifanekiso.

    • 2

      Iqiniso kakhulu @ google-d5279c8b66d25549a0ec3c8dd46a3d1a: disqus! Ngizokwethembeka ukuthi ngizizwa sengathi ama-plugins ambalwa afaka ithani ngaphezulu kubhulogi… futhi awukwazi ukuhambisa nje ingqikithi isuka kwesinye isayithi iye kwesinye, kufanele uqiniseke ukuthi uhambisa ama-plugins, futhi . Yisona sizathu kuphela engisebenza ukushumeka imisebenzi edingekayo kumafayili wetimu.

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.