{"id":2507,"date":"2015-07-19T07:09:20","date_gmt":"2015-07-19T07:09:20","guid":{"rendered":"http:\/\/musilda.cz\/?p=2507"},"modified":"2015-07-19T07:09:20","modified_gmt":"2015-07-19T07:09:20","slug":"co-jsou-to-uzivatelska-pole-neboli-custom-fields","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/co-jsou-to-uzivatelska-pole-neboli-custom-fields\/","title":{"rendered":"Co jsou to u\u017eivatelsk\u00e1 pole, neboli custom fields"},"content":{"rendered":"\n

S pojem custom fields, nebo tak\u00e9 u\u017eivatelsk\u00e9 pole, jste se ji\u017e ur\u010dit\u011b setkali. Pro ty, co netu\u0161\u00ed o co se jedn\u00e1, je zde podrobn\u00fd popis na co se pou\u017e\u00edvaj\u00ed a jak je vyu\u017e\u00edt.<\/p>\n\n\n\n\n\n\n\n

Pokud jste n\u011bkdy p\u00e1trali na diskuzn\u00edch f\u00f3rech, po \u0159e\u0161en\u00ed n\u011bjak\u00e9ho probl\u00e9mu, \u010dasto se v odpov\u011bd\u00edch vyskytuje pojem custom field. \u010cesk\u00fd ekvivalent k tomuto v\u00fdrazu je „u\u017eivatelsk\u00e9 pole“.<\/p>\n\n\n\n

Abychom pochopili, jak funguj\u00ed u\u017eivatelsk\u00e1 pole, mus\u00edme za\u010d\u00edt od za\u010d\u00e1tku, tedy od post\u016f.<\/p>\n\n\n\n

Ve WordPressu, jsu z\u00e1kladn\u00ed data o obsahu ukl\u00e1d\u00e1ny do tabulky wp_posts. To „wp_“ je pou\u017eito pro \u00fa\u010dely tohoto \u010dl\u00e1nku, p\u0159i instalaci si prefix tabulek m\u016f\u017eete zm\u011bnit, tak\u017ee se tabulka m\u016f\u017ee jmenovat web_posts.<\/p>\n\n\n\n

V t\u00e9to tabulce jsou r\u016fzn\u00e9 sloupce, jako je ID, post_title, post_content a dal\u0161\u00ed. Bohu\u017eel je jich v\u0161ak omezen\u00e9 mno\u017estv\u00ed.<\/p>\n\n\n\n

Co v\u0161ak d\u011blat, v p\u0159\u00edpad\u011b, \u017ee n\u00e1m 23 sloupc\u016f tabulky wp_posts nesta\u010d\u00ed?<\/p>\n\n\n\n

Pak p\u0159ich\u00e1zej\u00ed na \u0159adu u\u017eivatelsk\u00e1 pole. <\/strong><\/p>\n\n\n\n

V\u00fdvoj\u00e1\u0159i WordPressu tak do datab\u00e1ze p\u0159idali dal\u0161\u00ed tabulku, kter\u00e1 m\u00e1 pouh\u00e9 \u010dty\u0159i sloupce a jmenuje se wp_postmeta.<\/p>\n\n\n\n

Kdy\u017e n\u011bkdo p\u00ed\u0161e, nebo mluv\u00ed o metadata, custom fields, nebo u\u017eivatelsk\u00fdch pol\u00edch, t\u00fdk\u00e1 se to dat z t\u00e9to tabulky.<\/p>\n\n\n\n

N\u00e1zvy sloupc\u016f tabulky jsou:<\/p>\n\n\n\n