https:\/\/w3c.github.io\/resource-hints\/<\/a>.<\/p>\nFunkce pro pr\u00e1ci s hints m\u016f\u017ee nyn\u00ed vypadat n\u011bjak takto:<\/p>\n
function<\/code> makewp_example_resource_hints_attributes( <\/code>$hints<\/code>, <\/code>$relation_type<\/code> ) {<\/code>\n\n\u00a0\u00a0\u00a0\u00a0<\/code>if<\/code> ( <\/code>'prefetch'<\/code> === <\/code>$relation_type<\/code> ) {<\/code>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>$hints<\/code>[] = <\/code>array<\/code>(<\/code>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>'crossorigin'<\/code> => <\/code>'use-credentials'<\/code>,<\/code>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>'as'<\/code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 => <\/code>'style'<\/code>,<\/code>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>'pr'<\/code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 => 0.5,<\/code>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>'href'<\/code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 => <\/code>'https:\/\/example.com\/foo.css'<\/code>,<\/code>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>);<\/code>\n\u00a0\u00a0\u00a0\u00a0<\/code>}<\/code>\n\u00a0\u00a0\u00a0\u00a0<\/code>return<\/code> $hints<\/code>;<\/code>\n}<\/code>\nadd_filter( <\/code>'wp_resource_hints'<\/code>, <\/code>'makewp_example_resource_hints_attributes'<\/code>, 10, 2 );<\/code><\/pre>\n<\/div>\n
Zdroj k\u00f3du: make.wordpress.org<\/div>\n
<\/div>\n
Proto\u017ee m\u00e1 nov\u00fd WordPress p\u0159ij\u00edt ji\u017e za n\u011bkolik t\u00fddn\u016f, budu se novink\u00e1m v\u011bnovat i v dal\u0161\u00edch \u010dl\u00e1nc\u00edch.<\/div>\n","protected":false},"excerpt":{"rendered":"
Spr\u00e1vu resource hints podporuje WordPress ji\u017e od verze 4.6, ale v nov\u00e9 verzi je tato funkce roz\u0161\u00ed\u0159ena i na pr\u00e1ci s jejich atributy. V p\u0159\u00edpad\u011b, \u017ee nev\u00edte, co jsou resource hints, doporu\u010duji \u010dl\u00e1nek od Tom\u00e1\u0161e Matonohy. Z jeho data plyne, \u017ee hints nen\u00ed \u017e\u00e1dn\u00e1 novinka a v html k\u00f3du str\u00e1nek, jste se mohli setkat s<\/p>\n","protected":false},"author":1,"featured_media":8647,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,30],"tags":[469,508],"class_list":["post-3390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-novinky","category-wordpress","tag-wordpress-4-7","tag-wordpress-resource-hints"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/3390"}],"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=3390"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/3390\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8647"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=3390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=3390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=3390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}