Cov Ntawv Kev Cai Ncaj Ncees nrog Kev Cai Pawg

wordpress

WordPress tau dhau los ua qhov kev tsis txaus siab ntawm lub tuam txhab mus rau ntau lub tuam txhab, tab sis lub tuam txhab nruab nrab tsis tseem coj kom zoo dua ntawm ib feem ntawm lub peev xwm. Ib qho ntawm peb cov neeg xav tau ntxiv cov khoom seem rau lawv lub xaib tab sis tsis xav ua nws siv cov nplooj ntawv lossis hauv cov ntawv blog. Nov yog qhov uas WordPress txhawb nqa Hom Ncej Kev Cai rau!

Hauv qhov xwm txheej no, peb xav tau ntxiv Qhov Kev Pab Cuam los ua ib qho ntawm peb cov neeg siv cov xaib. Nws yog yooj yim haum ntxiv ib Hom Post Custom rau koj cov ntsiab lus WordPress. Koj ntxiv cov lej hauv qab no uas siv txoj haujlwm register_post_type rau koj functions.php nplooj:

// Ntxiv Cov Khoom Siv Custom Custom Type Hom add_action ('init', 'create_post_type'); muaj nuj nqi create_post_type () {register_post_type ('resources', array ('lab' '=> array (' npe '=> __ (' Resources ')),' singular_name '=> __ (' Resource '),' add_new '=> __ ('Ntxiv Tshiab'), 'add_new_item' => __ ('Ntxiv Cov Khoom Tshiab'), 'edit_item' => __ ('Hloov Cov Khoom Siv'), 'new_item' => __ ('Cov Khoom Tshiab'), 'all_items' => __ ('Txhua yam Khoom Siv'), 'view_item' => __ ('Saib Cov Ntaub Ntawv'), 'search_items' => __ ('Nrhiav Cov Ntaub Ntawv'), 'not_found' => __ ('Cov Khoom Siv Tsis Pom'), 'tsis_found_in_trash' => __ ('Tsis muaj chaw muab khoom pov tseg rau hauv thoob khib nyiab'), 'parent_item_colon' => '', 'menu_name' => __ ('Cov Khoom Siv')), 'pej xeem' => tseeb, 'has_archive' => muaj tseeb, 'rov sau dua' => array ('slug' => 'resources'), 'txhawb' => array ('npe', 'editor', 'sau', 'thuv', 'excerpt', 'tawm lus'))) ; }

Ib me ntsis nyuaj nrhiav yog yuav ua li cas pawg pawg rau koj Hom Post CustomCov. Ib qho laj thawj vim li cas nws yooj yim los xam seb yuav ua li cas ua qhov no vim tias nws hu ua ib qho kev cai sean thiab siv cov register_taxonomy muaj nuj nqi rau customize nws. Hauv qhov no, peb xav ntxiv cov peev txheej xws li Webinars, Whitepapers, thiab lwm yam rau lub ntsiab lus… yog li ntawm no yog qee qhov kev cai ntxiv rau cov ntaub ntawv functions.php:

add_action ('init', 'resource_category_init', 100); // 100 yog li hom xa ntawv tau tso npe muaj nuj nqi resource_category_init () {register_taxonomy ('hom', 'peev txheej', array ('cov ntawv' => array ('npe' => 'Chaw yam', 'singular_name' => ') Resource Type ',' search_items '=>' Nrhiav Cov Cuab Yeej Siv Ntaus ',' popular_items '=>' Cov Chaw Nrov Cov Hom ',' all_items '=>' Txhua Hom Khoom Siv ',' edit_item '=> __ (' Kho Cov Khoom Siv Hom ') , 'update_item' => __ ('Hloov tshiab Cov Hom Khoom Pab'), 'add_new_item' => __ ('Ntxiv Cov Khoom Siv Tshiab'), 'new_item_name' => __ ('Hom Khoom Siv Tshiab')), 'hierarchical' => 'cuav', 'daim ntawv lo' => 'Hom Khoom Siv')); }

Cov Kev Cai Post Type tseem tso cai rau koj los tsim cov ntaub ntawv archive thiab nplooj ntawv ib zaug rau koj Kev Cai Ntaus Kev Post. Tsuas yog luam cov ntawv archive.php thiab single.php. Hloov cov ntawv luam nrog daim the Hom Post Custom nyob rau hauv lub npe. Hauv qhov no, qhov ntawd yuav yog archive-resources.php thiab single-resources.php. Tam sim no koj tuaj yeem hloov cov nplooj ntawv no txawm li cas los koj xav tau nplooj ntawv cov khoom siv los saib.

2 Comments

  1. 1

    Lwm txoj kev yuav yog siv lub plugin zoo li Cov Lus Yoojyim Cov Lus Qhia lossis Cov Hom.

    Cov plugins tseem tuaj yeem pab koj kom yooj yim ntxiv cov kab kev cai meta thawv thiab tsim nplooj ntawv kev cai thiab cov qauv xa tom qab.

    • 2

      Muaj tseeb tiag @ google-d5279c8b66d25549a0ec3c8dd46a3d1a: disqus! Kuv yuav ncaj ncees tias kuv xav tias zoo li ob peb ntawm plugins ntxiv ib tuj ntawm nyiaj siv ua haujlwm rau lub blog… thiab koj tsis tuaj yeem tsuas yog tsiv lub ntsiab lus los ntawm ib qhov chaw xa mus rau tom ntej, koj yuav tsum paub tseeb tias koj tsiv lub plugins, ib yam nkaus Cov. Nws yog qhov laj thawj kuv ua haujlwm rau embed cov haujlwm tsim nyog hauv cov ntsiab lus.

Yuav ua li cas koj xav hais tias?

Qhov Web site no siv Akismet los txo cov kev pabcuam. Kawm li cas koj cov ntaub ntawv tawm tswv yim tiav.