{"id":1160,"date":"2013-09-24T20:15:49","date_gmt":"2013-09-24T20:15:49","guid":{"rendered":"http:\/\/musilda.cz\/?p=1160"},"modified":"2013-09-24T20:15:49","modified_gmt":"2013-09-24T20:15:49","slug":"funkce-get_permalink","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/funkce-get_permalink\/","title":{"rendered":"Funkce get_permalink"},"content":{"rendered":"

Funkce get_permalink() je podobn\u00e1 funkci the_permalink(), na rozd\u00edl od n\u00ed v\u0161ak vrac\u00ed prom\u011bnnou, odkaz se tak nevyp\u00ed\u0161e a vy s n\u00edm m\u016f\u017eete d\u00e1le pracovat. Lze ji pou\u017e\u00edt mimo loop a pokud ji pou\u017eijeme bez parametru ID, vr\u00e1t\u00ed url posledn\u00edho postu, ne url aktu\u00e1ln\u00ed str\u00e1nky.\u00a0<\/p>\n

Pou\u017eit\u00ed:<\/p>\n

\n$permalink = get_permalink( $id );\n<\/pre>\n

Parametry:<\/p>\n

$id – id postu, nebo str\u00e1nky, jeho\u017e url chceme z\u00edskat. M\u016f\u017ee b\u00fdt \u010d\u00edslo(id), nebo object, kdy z\u00edsk\u00e1te data pomoc\u00ed jin\u00e9 funkce, viz p\u0159\u00edklady.P\u0159i pou\u017eit\u00ed uvnit\u0159 loop je defaultn\u00ed hodnota id aktu\u00e1ln\u00edho \u010dl\u00e1nku.<\/p>\n

P\u0159\u00edklady:<\/p>\n

\necho get_permalink( 268 );\n<\/pre>\n

Zobraz\u00ed url postu s id 268<\/p>\n

\necho esc_url( get_permalink( get_page_by_title( 'Monthly Events' ) ) );\n<\/pre>\n

Zobraz\u00ed url postu s titulkem Monthly Events. Toto je p\u0159\u00edklad, kdy je parametrem objekt.<\/p>\n","protected":false},"excerpt":{"rendered":"

Funkce get_permalink() je podobn\u00e1 funkci the_permalink(), na rozd\u00edl od n\u00ed v\u0161ak vrac\u00ed prom\u011bnnou, odkaz se tak nevyp\u00ed\u0161e a vy s n\u00edm m\u016f\u017eete d\u00e1le pracovat. Lze ji pou\u017e\u00edt mimo loop a pokud ji pou\u017eijeme bez parametru ID, vr\u00e1t\u00ed url posledn\u00edho postu, ne url aktu\u00e1ln\u00ed str\u00e1nky.\u00a0<\/p>\n","protected":false},"author":1,"featured_media":8523,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,15],"tags":[],"class_list":["post-1160","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codex","category-post-funkce"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1160"}],"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=1160"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1160\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8523"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=1160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=1160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=1160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}