{"id":937,"date":"2012-09-08T16:30:27","date_gmt":"2012-09-08T09:30:27","guid":{"rendered":"http:\/\/pridio.com\/?p=937"},"modified":"2012-09-11T14:01:23","modified_gmt":"2012-09-11T07:01:23","slug":"cau-truc-theme-wordpress","status":"publish","type":"post","link":"https:\/\/pridio.com\/en\/kien-thuc\/website-marketing\/cau-truc-theme-wordpress\/","title":{"rendered":"C\u1ea5u tr\u00fac theme WordPress"},"content":{"rendered":"<h2>C\u00e1c thu\u1eadt ng\u1eef c\u01a1 b\u1ea3n<\/h2>\n<p>\u0110\u1ec3 tr\u1edf th\u00e0nh m\u1ed9t nh\u00e0 ph\u00e1t tri\u1ec3n web (web developer) hay m\u1ed9t nh\u00e0 thi\u1ebft k\u1ebft web (web designer) b\u1eb1ng wordpress b\u1ea1n c\u1ea7n hi\u1ec3u \u0111\u01b0\u1ee3c c\u1ea5u tr\u00fac c\u1ee7a m\u1ed9t theme wordpress. Tr\u01b0\u1edbc h\u1ebft ta n\u00ean \u0111i v\u00e0o t\u00ecm hi\u1ec3u 2 thu\u1eadt ng\u1eef kh\u00e1 ph\u1ed5 bi\u1ebfn nh\u01b0ng kh\u00f4ng k\u00e9m ph\u1ea7n quan tr\u1ecdng:<\/p>\n<p><strong>&#8211; Theme<\/strong>: \u0110\u00e2y l\u00e0 m\u1ed9t t\u1eadp h\u1ee3p c\u00e1c t\u1eadp tin c\u00f3 ch\u1ee9a h\u00ecnh \u1ea3nh, \u00e2m thanh, code,.. gi\u00fap h\u00ecnh th\u00e0nh n\u00ean giao di\u1ec7n c\u1ee7a trang web<\/p>\n<p><strong>&#8211; Template:<\/strong> L\u00e0 m\u1ed9t \u0111o\u1ea1n code \u0111\u01b0\u1ee3c vi\u1ebft d\u01b0\u1edbi d\u1ea1ng m\u1ed9t h\u00e0m hay l\u01b0u tr\u1eef trong 1 file b\u1eb1ng ng\u00f4n ng\u1eef PHP \u0111\u1ec3 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng l\u1ea1i nhi\u1ec1u l\u1ea7n. C\u1ea5u tr\u00fac theme c\u1ee7a wordpress ch\u00ednh l\u00e0 t\u1ea1o ra t\u1eeb c\u00e1c template, \u0111\u01b0\u1ee3c g\u1ecdi b\u1edfi c\u00e1c h\u00e0m \u0111\u00e3 \u0111\u01b0\u1ee3c x\u00e2y d\u1ef1ng s\u1eb5n c\u1ee7a wordpress ho\u1eb7c do ng\u01b0\u1eddi d\u00f9ng t\u1ef1 t\u1ea1o.<\/p>\n<p><strong>&#8211; CSS:<\/strong> l\u00e0 code \u0111\u01b0\u1ee3c vi\u1ebft b\u1eb1ng ng\u00f4n ng\u1eef CSS d\u00f9ng \u0111\u1ec3 t\u00e1c \u0111\u1ed9ng t\u1edbi giao di\u1ec7n c\u1ee7a to\u00e0n trang. Th\u00f4ng th\u01b0\u1eddng stylesheet ch\u00ednh \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o file style.css nh\u01b0ng c\u0169ng c\u00f3 th\u1ec3 t\u00f9y ch\u1ec9nh do ng\u01b0\u1eddi d\u00f9ng.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-957\" src=\"http:\/\/pridio.com\/wp-content\/uploads\/2012\/09\/theme-wordpress-565x287.jpg\" alt=\"theme wordpress\" width=\"565\" height=\"287\" srcset=\"https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress-565x287.jpg 565w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress-300x152.jpg 300w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress-800x406.jpg 800w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress-530x269.jpg 530w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress-118x60.jpg 118w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress-619x315.jpg 619w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-wordpress.jpg 1131w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/p>\n<h2>Danh s\u00e1ch template wordpress<\/h2>\n<p>M\u1ed9t theme wordpress \u0111\u01b0\u1ee3c t\u1ea1o ra b\u1eb1ng h\u1ec7 th\u1ed1ng truy c\u1eadp ph\u00e2n c\u1ea5p v\u00e0o c\u00e1c template, th\u00f4ng th\u01b0\u1eddng \u0111\u1ec3 g\u1ecdi nh\u1eefng template s\u1eb5n c\u00f3 wordpress cung c\u1ea5p s\u1eb5n nh\u1eefng h\u00e0m g\u1ecdi \u0111\u00e3 \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a (c\u00e1c h\u00e0m th\u01b0\u1eddng b\u1eaft \u0111\u1ea7u b\u1eb1ng ch\u1eef wp_ ). T\u1ea5t nhi\u00ean \u0111\u1ec3 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng \u0111\u01b0\u1ee3c c\u00e1c h\u00e0m n\u00e0y th\u00ec b\u1ea1n ph\u1ea3i \u0111\u1eb7t t\u00ean c\u00e1c template theo chu\u1ea9n wordpress n\u1ebfu kh\u00f4ng mu\u1ed1n ph\u1ea3i \u0111\u1ecbnh ngh\u0129a l\u1ea1i.<\/p>\n<p>M\u1ed9t theme c\u01a1 b\u1ea3n nh\u1ea5t c\u1ee7a theme wordpress c\u1ea7n 2 file ch\u00ednh l\u00e0 index.php v\u00e0 style.css. Khi ph\u00e1t tri\u1ec3n web ho\u00e0n thi\u1ec7n s\u1ebd c\u1ea7n c\u00e1c file template kh\u00e1c, sau \u0111\u00e2y m\u00ecnh s\u1ebd gi\u1ea3i th\u00edch nh\u1eefng template quan tr\u1ecdng th\u01b0\u1eddng c\u00f3 trong c\u00e1c theme d\u1ef1ng s\u1eb5n, \u0111\u01b0\u1ee3c l\u01b0u trong th\u01b0 m\u1ee5c public.html\/wp-content\/themes:<\/p>\n<p><strong>&#8211; style.css<\/strong> : Stylesheet ch\u00ednh. Ch\u1ee9a c\u00e1c \u0111o\u1ea1n code CSS cho theme, \u0111\u01b0\u1ee3c g\u1ecdi t\u1eeb header.<\/p>\n<p><strong>&#8211; rtl.css<\/strong> : File n\u00e0y t\u1ef1 \u0111\u1ed9ng h\u01b0\u1edbng trang web t\u1eeb ph\u1ea3i sang tr\u00e1i, c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c t\u1ea1o b\u1eb1ng plug-in RTLer.<\/p>\n<p><strong>&#8211; index.php<\/strong> : \u0111\u1ec3 hi\u1ec3n th\u1ecb trang ch\u1ee7, n\u00f3 s\u1ebd hi\u1ec3n th\u1ecb nh\u1eefng b\u00e0i vi\u1ebft \u1edf d\u1ea1ng t\u00f3m t\u1eaft ho\u1eb7c thu g\u1ecdn theo \u00fd ng\u01b0\u1eddi l\u1eadp tr\u00ecnh<\/p>\n<p><strong>&#8211; comments.php<\/strong> : C\u00e1c \u00fd ki\u1ebfn ho\u1eb7c ph\u1ea3n h\u1ed3i, ping back, track back t\u1edbi trang web. \u1ede c\u00e1c template n\u00e0y kh\u00f4ng n\u00ean ch\u1ee9a c\u00e1c \u0111\u1ecbnh ngh\u0129a function m\u00e0 b\u1ea1n mu\u1ed1n th\u00eam v\u00e0o m\u00e0 h\u00e3y \u0111\u1ec3 ch\u00fang trong h\u00e0m functions.php<\/p>\n<p><strong>&#8211; front-page.php<\/strong> : Trang front-page, th\u01b0\u1eddng d\u00f9ng khi b\u1ea1n mu\u1ed1n hi\u1ec3n th\u1ecb m\u1ed9t trang t\u0129nh<\/p>\n<p><strong>&#8211; home.php<\/strong> : Th\u01b0\u1eddng d\u00f9ng khi b\u1ea1n mu\u1ed1n c\u00f3 m\u1ed9t front-page t\u0129nh nh\u01b0ng c\u00f3 c\u1eadp nh\u1eadt c\u00e1c b\u00e0i vi\u1ebft m\u1edbi nh\u1ea5t<\/p>\n<p><strong>&#8211; single.php<\/strong> : Tr\u00ecnh b\u00e0y m\u1ed9t post<\/p>\n<p><strong>&#8211;\u00a0single-&lt;post-type&gt;.php<\/strong> : Tr\u00ecnh b\u00e0y post c\u00f3 s\u1ef1 \u0111i\u1ec1u ch\u1ec9nh ri\u00eang nh\u1ea5t \u0111\u1ecbnh.<\/p>\n<p><strong>&#8211; page.php<\/strong> : Tr\u00ecnh b\u00e0y m\u1ed9t page<\/p>\n<p><strong>&#8211; category.php<\/strong> : Tr\u00ecnh b\u00e0y m\u1ed9t category &#8211; th\u01b0 m\u1ee5c<\/p>\n<p><strong>&#8211; tag.php<\/strong> : Tr\u00ecnh b\u00e0y m\u1ed9t tag, khi m\u1ed9t t\u1eeb kh\u00f3a \u0111\u01b0\u1ee3c truy v\u1ea5n<\/p>\n<p><strong>&#8211; taxonomy.php<\/strong> : Tr\u00ecnh b\u00e0y m\u1ed9t ph\u00e2n lo\u1ea1i, khi m\u1ed9t ph\u00e2n lo\u1ea1i \u0111\u01b0\u1ee3c truy v\u1ea5n<\/p>\n<p><strong>&#8211; author.php<\/strong> : Tr\u00ecnh b\u00e0y t\u00e1c gi\u1ea3, ng\u01b0\u1eddi vi\u1ebft hay ng\u01b0\u1eddi ph\u1ea3n h\u1ed3i<\/p>\n<p><strong>&#8211; date.php<\/strong> : Tr\u00ecnh b\u00e0y ng\u00e0y th\u00e1ng<\/p>\n<p><strong>&#8211; archive.php<\/strong> : \u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng khi t\u00e1c gi\u1ea3, ng\u00e0y th\u00e1ng, hay th\u01b0 m\u1ee5c \u0111\u01b0\u1ee3c truy v\u1ea5n. N\u00f3 s\u1ebd b\u1ecb ghi \u0111\u00e8 b\u1edfi author.php, date.php, category.php<\/p>\n<p><strong>&#8211; search.php<\/strong> : Tr\u00ecnh b\u00e0y khi m\u1ed9t k\u1ebft qu\u1ea3 t\u00ecm ki\u1ebfm \u0111\u01b0\u1ee3c truy v\u1ea5n<\/p>\n<p><strong>&#8211; attachment.php<\/strong> : Tr\u00ecnh b\u00e0y khi xem m\u1ed9t t\u1eadp tin \u0111\u00ednh k\u00e8m<\/p>\n<p><strong>&#8211; image.php<\/strong> : Tr\u00ecnh b\u00e0y khi xem m\u1ed9t h\u00ecnh \u1ea3nh \u0111\u00ednh k\u00e8m<\/p>\n<p><strong>&#8211; 404.php<\/strong> : Tr\u00ecnh b\u00e0y khi nh\u1eadp sai URL, wordpress kh\u00f4ng th\u1ec3 t\u00ecm th\u1ea5y b\u00e0i vi\u1ebft ph\u00f9 h\u1ee3p truy v\u1ea5n.<\/p>\n<p>Ngo\u00e0i ra c\u00f2n c\u00f3 th\u1ec3 c\u00f3 template kh\u00e1c t\u00f9y theo t\u1eebng theme<\/p>\n<h2>C\u1ea5u tr\u00fac theme wordpress<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-938\" src=\"http:\/\/pridio.com\/wp-content\/uploads\/2012\/09\/theme-struction.jpg\" alt=\"theme struction\" width=\"500\" height=\"333\" srcset=\"https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-struction.jpg 500w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-struction-300x199.jpg 300w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-struction-90x60.jpg 90w, https:\/\/pridio.com\/en\/wp-content\/uploads\/2012\/09\/theme-struction-472x315.jpg 472w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>V\u1ec1 t\u1ed5ng quan m\u1ed9t giao di\u1ec7n web trong wordpress s\u1ebd \u0111\u01b0\u1ee3c b\u1ed1 tr\u00ed nh\u01b0 tr\u00ean. Trong \u0111\u00f3 c\u00e1c ph\u1ea7n \u0111\u01b0\u1ee3c \u0111\u1ecbnh ngh\u0129a nh\u01b0 sau<\/p>\n<h3>Head v\u00e0 thanh ti\u00eau \u0111\u1ec1 (header.php)<\/h3>\n<p>&#8211; Bao g\u1ed3m th\u1ebb m\u1edf &lt;html&gt; v\u00e0 ph\u1ea7n &lt;head&gt; v\u00e0 ph\u1ea7n ti\u00eau \u0111\u1ec1 (navigation) hi\u1ec3n th\u1ecb ph\u1ea7n \u0111\u1ea7u c\u1ee7a web.<\/p>\n<p>&#8211; Link t\u1edbi file CSS, d\u00f9ng l\u1ec7nh <em>wp_head()<\/em> \u0111\u1ec3 g\u1ecdi stylesheet, script hay c\u00e1c fucntion kh\u00e1c.<\/p>\n<p>&#8211; G\u1ecdi ra b\u1edfi h\u00e0m c\u00f3 s\u1eb5n trong wordpress l\u00e0 <em>wp_get_header().<\/em><\/p>\n<h3>Widgets (sidebar.php)<\/h3>\n<p>&#8211; Ch\u1ee9a c\u00e1c code v\u1ec1 sidebar hai b\u00ean c\u1ea1nh trang web v\u1ec1 link blog, m\u00e2y th\u1ebb&#8230;. hi\u1ec3n th\u1ecb hai b\u00ean c\u1ee7a web.<\/p>\n<p>&#8211; C\u00e1c code c\u00f3 th\u1ec3 m\u1eb7c \u0111\u1ecbnh ho\u1eb7c s\u1ebd xu\u1ea5t hi\u1ec7n khi k\u00edch ho\u1ea1t trong Appearance -&gt; Widgets<\/p>\n<h3>Single Post (post.php), Home (index.php), Page (page.php)<\/h3>\n<p>&#8211; \u0110\u00e3 gi\u1edbi thi\u1ec7u \u1edf tr\u00ean, s\u1ebd hi\u1ec3n th\u1ecb ph\u1ea7n ch\u00ednh c\u1ee7a web.<\/p>\n<h3>L\u01b0u tr\u1eef (archive.php)<\/h3>\n<p>&#8211;\u00a0Hi\u1ec3n th\u1ecb l\u01b0u tr\u1eef ti\u00eau \u0111\u1ec1 (tag, category, date-based, ho\u1eb7c author archive).<\/p>\n<p>&#8211; Hi\u1ec3n th\u1ecb m\u1ed9t danh s\u00e1ch c\u00e1c b\u00e0i vi\u1ebft trong \u0111o\u1ea1n tr\u00edch ho\u1eb7c h\u00ecnh th\u1ee9c \u0111\u1ea7y \u0111\u1ee7<\/p>\n<p>&#8211; Bao g\u1ed3m\u00a0<em>wp_link_pages ()<\/em>\u00a0\u0111\u1ec3 h\u1ed7 tr\u1ee3 chuy\u1ec3n h\u01b0\u1edbng c\u00e1c li\u00ean k\u1ebft trong b\u00e0i vi\u1ebft.<\/p>\n<h3>B\u00ecnh lu\u1eadn (comments.php), T\u00ecm ki\u1ebfm (search.php)<\/h3>\n<p>&#8211; \u0110\u00e2y l\u00e0 c\u00e1c template ch\u1ee9c n\u0103ng, d\u00f9ng khi c\u1ea7n s\u1eed d\u1ee5ng c\u00e1c ch\u1ee9c n\u0103ng n\u00e0y<\/p>\n<h3>Footer (footer.php)<\/h3>\n<p>&#8211; Ch\u1ee9a c\u00e1c m\u00e3 li\u00ean quan t\u1edbi menu footer, \u0111\u00f3ng d\u1ea5u b\u1ea3n quy\u1ec1n v.v&#8230;. hi\u1ec3n th\u1ecb \u1edf ch\u00e2n trang web.<\/p>\n<p>&#8211; Ch\u1ee9a th\u1ebb \u0111\u00f3ng &lt;\/body&gt; v\u00e0 &lt;\/html&gt;. G\u1ecdi ra b\u1edfi h\u00e0m c\u00f3 s\u1eb5n c\u1ee7a wordpress l\u00e0 <em>wp_get_footer().<\/em><\/p>\n<p>V\u1eady l\u00e0 c\u00e1c b\u1ea1n \u0111\u00e3 t\u00ecm hi\u1ec3u s\u01a1 qua m\u1ed9t v\u00f2ng c\u1ea5u tr\u00fac c\u1ee7a m\u1ed9t theme wordpress. B\u00e0i vi\u1ebft n\u00e0y m\u00ecnh kh\u00f4ng \u0111i s\u00e2u v\u00e0o code m\u00e0 ch\u1ec9 cho c\u00e1c b\u1ea1n th\u1ea5y t\u1ed5ng quan n\u00ean ph\u1ea7n code c\u1ee5 th\u1ec3 \u0111\u1ec3 g\u1ecdi h\u00e0m m\u00ecnh s\u1ebd tr\u00ecnh b\u00e0y v\u00e0o c\u00e1c ph\u1ea7n sau. \u00a0Ch\u00fac c\u00e1c b\u1ea1n c\u00f3 \u0111\u01b0\u1ee3c c\u00e1i nh\u00ecn r\u00f5 r\u00e0ng h\u01a1n v\u1ec1 m\u1ed9t theme wordpress \u0111\u1ec3 c\u00f3 th\u1ec3 \u0111i \u0111\u01b0\u1ee3c nh\u1eefng b\u01b0\u1edbc \u0111\u1ea7u l\u00e0m ch\u1ee7 wordpress thu\u1eadn l\u1ee3i \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00e1c thu\u1eadt ng\u1eef c\u01a1 b\u1ea3n \u0110\u1ec3 tr\u1edf th\u00e0nh m\u1ed9t nh\u00e0 ph\u00e1t tri\u1ec3n web (web developer) hay m\u1ed9t nh\u00e0 thi\u1ebft k\u1ebft web (web designer) b\u1eb1ng wordpress b\u1ea1n c\u1ea7n hi\u1ec3u \u0111\u01b0\u1ee3c c\u1ea5u tr\u00fac c\u1ee7a m\u1ed9t theme wordpress. Tr\u01b0\u1edbc h\u1ebft ta n\u00ean \u0111i&#8230;<\/p>\n","protected":false},"author":16,"featured_media":957,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"tags":[47,17],"class_list":["post-937","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-marketing","tag-theme-wordpress","tag-wordpress-2"],"acf":[],"_links":{"self":[{"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/posts\/937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/comments?post=937"}],"version-history":[{"count":0,"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/posts\/937\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/media\/957"}],"wp:attachment":[{"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/media?parent=937"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pridio.com\/en\/wp-json\/wp\/v2\/tags?post=937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}