{"id":698,"date":"2013-06-26T18:08:45","date_gmt":"2013-06-26T18:08:45","guid":{"rendered":"http:\/\/musilda.cz\/?p=698"},"modified":"2013-06-26T18:08:45","modified_gmt":"2013-06-26T18:08:45","slug":"jak-vlozit-fotografii-do-profilu-uzivatele-ve-wordpress","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-vlozit-fotografii-do-profilu-uzivatele-ve-wordpress\/","title":{"rendered":"Jak vlo\u017eit fotografii do profilu u\u017eivatele ve WordPress"},"content":{"rendered":"

K dne\u0161n\u00edmu \u010dl\u00e1nku mne inspiroval koment\u00e1\u0159, kter\u00fd se zde ned\u00e1vno objevil. Proto\u017ee jsem v tu chv\u00edli nem\u011bl \u010das vym\u00fd\u0161let \u0159e\u0161en\u00ed, jak do profilu u\u017eivatele p\u0159idat mo\u017enost vlo\u017eit fotografii, doporu\u010dil jsem plugin. Vzhledem k tomu, \u017ee nejsem p\u0159\u00edznivcem bezhlav\u00e9ho pou\u017e\u00edv\u00e1n\u00ed plugin\u016f, uk\u00e1\u017ei v\u00e1m v tomto n\u00e1vodu, jak vlo\u017eit do profilu pole pro url adresu fotografie u\u017eivatele.\u00a0<\/p>\n

Prvn\u00ed v\u011bc, kterou mus\u00edme ud\u011blat, je nahr\u00e1t fotografii na web a zn\u00e1t jej\u00ed url. Pokud budete nahr\u00e1vat fotografii v\u011bt\u0161\u00ed, ne\u017e je velikost, v kter\u00e9 se bude zobrazovat, nezapome\u0148te ji pomoc\u00ed styl\u016f zmen\u0161it. Nyn\u00ed ji\u017e k samotn\u00e9 \u00faprav\u011b.<\/p>\n

Otev\u0159eme si soubor functions.php a do n\u011bj vlo\u017e\u00edme n\u00e1sleduj\u00edc\u00ed k\u00f3d:<\/p>\n

\nadd_action( 'show_user_profile', 'my_photo_fields' );\nadd_action( 'edit_user_profile', 'my_photo_fields' );\n\nfunction my_photo_fields( $user ) { ?>\n\n\n\n
\n<img src="ID ) ); ?>\" width=\"80\" \/>\n<\/td>\n
<\/th>\n\n<input type="text" name="pic" id="pic" value="\nID ) ); ?>\" class=\"regular-text\" \/>\nInsert url your image<\/span>\n<\/td>\n<\/tr>\n<\/table>\n<?php }\n<\/pre>\n

V profilu u\u017eivatele se n\u00e1m objev\u00ed pole pro url fotografie, po ulo\u017een\u00ed se n\u00e1m zobraz\u00ed vlo\u017een\u00e9 foto
\n\"\"<\/a><\/p>\n

Pro zobrazen\u00ed profilu u\u017eivatele vlo\u017e\u00edme, nebo uprav\u00edme k\u00f3d v single.php, \u010di v content.php takto:<\/p>\n

\n
\n
\n<img src="\"\nalt=\"\" width=\"68\" \/>\n<\/div>\n
\n

<\/h2>\n

<\/p>\n

\n<a href="\"\nrel=\"author\">\n<?php printf( __( 'View all posts by %s →<\/span>', 'twentytwelve' )\n, get_the_author() ); ?>\n<\/a>\n<\/div>\n<\/div>\n<\/div>\n<\/pre>\n

Tato \u00faprava je pro \u0161ablonu twentytwelve, kterou pou\u017e\u00edv\u00e1m na testovac\u00edm webu a v\u00fdsledek m\u016f\u017eete vid\u011bt zde<\/a><\/p>\n

Jak vid\u00edte, \u00faprava je jednoduch\u00e1 a nemus\u00edte kv\u016fli tomu pou\u017e\u00edvat plugin.<\/p>\n","protected":false},"excerpt":{"rendered":"

K dne\u0161n\u00edmu \u010dl\u00e1nku mne inspiroval koment\u00e1\u0159, kter\u00fd se zde ned\u00e1vno objevil. Proto\u017ee jsem v tu chv\u00edli nem\u011bl \u010das vym\u00fd\u0161let \u0159e\u0161en\u00ed, jak do profilu u\u017eivatele p\u0159idat mo\u017enost vlo\u017eit fotografii, doporu\u010dil jsem plugin. Vzhledem k tomu, \u017ee nejsem p\u0159\u00edznivcem bezhlav\u00e9ho pou\u017e\u00edv\u00e1n\u00ed plugin\u016f, uk\u00e1\u017ei v\u00e1m v tomto n\u00e1vodu, jak vlo\u017eit do profilu pole pro url adresu fotografie u\u017eivatele.\u00a0<\/p>\n","protected":false},"author":1,"featured_media":8624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[12,30],"tags":[146],"class_list":["post-698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-navody","category-wordpress","tag-foto-uzivatele-wordpress"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/698"}],"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=698"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/698\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8624"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}