Custom Post Ituaiga ma Custom Vaega

wordpress

O le WordPress ua avea ma se mea taua tele i le tele o kamupani, ae o le averesi kamupani e le faʻaaogaina se vaega o mea mafai. O se tasi o matou tagata maʻi manaʻo e faʻaopopo se punaoa vaega i la latou 'upega tafaʻilagi ae le manaʻo e faia e faʻaaoga ai itulau poʻo i blog blog. O le mea tonu lava lea e lagolagoina e le WordPress Faʻasologa o Faʻamaumauga aua!

I lenei tulaga, matou te manaʻo e faʻaopopo se Punaoa Vaega i se tasi oa matou 'au upega tafailagi' upega tafaʻilagi. E faigofie lava e faʻaopopo a Custom Post Type i lau autu WordPress. Oe faʻaopopo le numera mulimuli i le faʻaaogaina o le gaioiga resitara_post_type i lau pages.php itulau:

// Add Resources Custom Post Type add_action ('init', 'create_post_type'); function create_post_type () {register_post_type ('resource', array ('labels' => array ('name' => __ ('Resources'), 'singular_name' => __ ('Resource'), 'add_new' => __ ('Add New'), 'add_new_item' => __ ('Add New Resource'), 'edit_item' => __ ('Edit Resource'), 'new_item' => __ ('New Resource'), 'all_items' => __ ('All Resources'), 'view_item' => __ ('View Resource'), 'search_items' => __ ('Search Resources'), 'not_found' => __ ('Resource Not Found'), 'not_found_in_trash' => __ ('Leai Ni Punaoa i Lapisi'), 'parent_item_colon' => '', 'menu_name' => __ ('Punaoa')), 'lautele' => moni, 'has_archive' => moni, 'rewrite' => array ('slug' => 'Punaoa'), 'lagolagoina' => faasologa ('ulutala', 'faatonu', 'tusitala', 'thumbnail', 'excerpt', 'comments')) ; }

E fai lava sina faigata ona maua o le faʻafefea ona fai vaega faʻapitoa mo lou Custom Post Type. O se tasi mafuaʻaga e faigata ai ona iloa pe faʻafefea ona faia lenei mea ona ua taʻua o se lafoga masani ma faʻaaogaina le resitala_taxonomy galue e faʻapitoa ia. I lenei tulaga, matou te mananaʻo e faʻaopopo ni mea taua e pei o Webinars, Whitepapers, ma isi i le autu ... o lea la o ni nai faʻaopopo code mo faila functions.php:

add_action ('init', 'resource_category_init', 100); // 100 o lea ua uma ona lesitalaina le pou pou resource_category_init () {register_taxonomy ('type', 'resources', array ('labels' => array ('name' => 'Resource Type', 'singular_name' => ' Punaoa Ituaiga ',' search_items '=>' Suʻesuʻe Ituaiga Punaoa ',' popular_items '=>' Ituaiga Punaoa Taua ',' all_items '=>' Uma Punaoa Ituaiga ',' edit_item '=> __ (' Faʻatonutonu Punaoa Ituaiga ') , 'update_item' => __ ('Update Resource Type'), 'add_new_item' => __ ('Add New Resource Type'), 'new_item_name' => __ ('New Resource Type')), 'hierarchical' => 'sese', 'igoa' => 'Ituaiga Punaoa')); }

O le Custom Post Types e faʻatagaina ai oe ona mamanuina le potu teuoloa ma itulau e tasi mo au Custom Post Type. Naʻo le kopiina o le archive.php ma le single.php faila. Toe faaigoa ia kopi i le Custom Post Type i le igoa. I lenei tulaga, o le a avea ma archive-Resources.php ma nofofua-resource.php. O lenei e mafai ona e faʻapitoaina na itulau ae peitaʻi e te manaʻo e vaʻai le itulau faʻavae.

2 Faamatalaga

  1. 1

    O le isi auala o le faʻaaogaina lea o se plug e pei o Easy Custom Content Ituaiga poʻo Ituaiga.

    O nei plugini mafai ai foi ona e faʻaopopoina faigofie meta pusa ma faia tu ma aga itulau ma faapipii template.

    • 2

      Matua moni @ google-d5279c8b66d25549a0ec3c8dd46a3d1a: disqus! O le a ou faʻamaoni ou te lagona e pei o ni nai plugini faʻaopoopoina tone o luga luga o le blog ... ma oe le mafai ona na o le aveina o se autu mai le tasi 'upega tafaʻilagi i le isi, e tatau ona e mautinoa ia faʻafesoʻotaʻi foʻi plugini . Pau lava lea o le mafuaʻaga ou te galue ai e faʻatutu galuega talafeagai i faila autu.

O le'a sou manatu?

O lenei 'upega tafaʻilagi e faʻaaogaina le Akismet e faʻaitiitia le spam. Aoao pe faapefea ona faʻasoa lau faʻamatalaga faʻamatalaga.