{"id":2282,"date":"2014-12-23T19:40:29","date_gmt":"2014-12-23T19:40:29","guid":{"rendered":"http:\/\/musilda.cz\/?p=2282"},"modified":"2014-12-23T19:40:29","modified_gmt":"2014-12-23T19:40:29","slug":"nove-funkce-pro-vypis-archivu-ve-wordpress4-1","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/nove-funkce-pro-vypis-archivu-ve-wordpress4-1\/","title":{"rendered":"Nov\u00e9 funkce pro v\u00fdpis arch\u00edvu ve WordPress4.1"},"content":{"rendered":"\n
Nov\u00fd WordPress je ji\u017e n\u011bkolik dn\u00ed k dispozici a proto je nejvy\u0161\u0161\u00ed \u010das, pod\u00edvat se na n\u011bkter\u00e9 novinky ve funkc\u00edch. Dv\u011b velmi „\u0161ikovn\u00e9“ se t\u00fdkaj\u00ed \u0161ablony pro v\u00fdpis arch\u00edvu.<\/p>\n\n\n\n\n\n\n\n
Pokud jste ji\u017e n\u011bjakou \u0161ablonu vytvo\u0159ili, nebo upravovali, \u010dasto jste se v souboru archive.php setkali s neforemnou konstrukc\u00ed if archive, is_day atd…<\/p>\n\n\n\n
\u010cty\u0159i nov\u00e9 funkce toto odstra\u0148uj\u00ed, respektive p\u0159esouvaj\u00ed do souboru general-templates.php ve slo\u017ece wp-includes. Funkce to jsou sice \u010dty\u0159i, ale jedn\u00e1 se o dv\u011b, u ka\u017ed\u00e9 s variantou echo a get.<\/p>\n\n\n\n
Jedn\u00e1 se o:<\/p>\n\n\n\n
Funkce vrac\u00ed odpov\u00eddaj\u00edc\u00ed titulek, dle toho o jak\u00fd typ arch\u00edvu se jedn\u00e1 a odpov\u00eddaj\u00edc\u00ed popis.<\/p>\n\n\n\n
Get_the_archive_title<\/strong> vrac\u00ed titulek arch\u00edvu a je v n\u00ed p\u0159ipraven filter get_the_archive_title<\/strong>.<\/p>\n\n\n\n The_archive_title<\/strong> je wraper pro get_the_archive_title, titulek rovnou vyp\u00ed\u0161e a p\u0159ij\u00edm\u00e1 argumenty $before a $after. Argumenty jsou mysl\u00edm vypov\u00eddaj\u00edc\u00ed, defaultn\u011b jsou pr\u00e1zdn\u00e9.<\/p>\n\n\n\n Get_the_archive_description<\/strong> vrac\u00ed hodnotu pomoc\u00ed term_description() a je do n\u00ed zav\u011b\u0161en filter get_the_archive_description.<\/p>\n\n\n\n The_archive_description<\/strong> je obdobn\u011b, jako the_archive_title wrapper pro get_the_archive_description a m\u00e1 tak\u00e9 argumenty $before a $after.<\/p>\n\n\n\n Tyto funkce byly ji\u017e dlouho pot\u0159eba, nyn\u00ed bude archive.php daleko p\u0159ehledn\u011bj\u0161\u00ed a d\u00edky filtr\u016fm, budou moci s titulkem a popisem, pracovat i pluginy. Asi budu muset p\u0159epracovat i m\u016fj plugin Custom Category Meta<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" Nov\u00fd WordPress je ji\u017e n\u011bkolik dn\u00ed k dispozici a proto je nejvy\u0161\u0161\u00ed \u010das, pod\u00edvat se na n\u011bkter\u00e9 novinky ve funkc\u00edch. Dv\u011b velmi „\u0161ikovn\u00e9“ se t\u00fdkaj\u00ed \u0161ablony pro v\u00fdpis arch\u00edvu.<\/p>\n","protected":false},"author":1,"featured_media":1978,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-2282","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2282"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=2282"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2282\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/1978"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=2282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}