{"id":9820,"date":"2013-05-05T19:04:26","date_gmt":"2013-05-05T19:04:26","guid":{"rendered":"http:\/\/musilda.cz\/?p=321"},"modified":"2013-05-05T19:04:26","modified_gmt":"2013-05-05T19:04:26","slug":"jak-pridat-odkazy-do-admin-baru-ve-wordpressu","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-pridat-odkazy-do-admin-baru-ve-wordpressu\/","title":{"rendered":"Jak p\u0159idat odkazy do admin baru ve WordPressu"},"content":{"rendered":"\n

V dne\u0161n\u00edm \u010dl\u00e1nku nav\u00e1\u017ei na p\u0159edchoz\u00ed, ve kter\u00e9m jsme z admin baru odstranili odkazy a dnes si uk\u00e1\u017eeme jak naopak odkazy do admin baru m\u016f\u017eeme p\u0159idat. P\u0159id\u00e1me nejprve jeden odkaz, n\u00e1sledn\u011b vytvo\u0159\u00edme drop down menu a nakonec je\u0161t\u011b jedno submenu. M\u016f\u017eeme si tak do admin baru p\u0159idat odkazy na r\u016fzn\u00e1 nastaven\u00ed plugin\u016f, theme options, zkr\u00e1tka v\u0161e co pot\u0159ebujeme m\u00edt st\u00e1le po ruce.<\/p>\n\n\n\n\n\n\n\n

P\u0159id\u00e1n\u00ed jednoho odkazu do admin baru<\/h2>\n\n\n\n
function add_novylink_admin_bar_link() {\n\tglobal $wp_admin_bar;\n\tif ( !is_super_admin() || !is_admin_bar_showing() )\n\t\treturn;\n\t$wp_admin_bar->add_menu( array(\n\t'id' => 'novy_link',\n\t'title' => __( 'Novy link'),\n\t'href' => __('http:\/\/novylink.com'),\n\t) );\n}\nadd_action('admin_bar_menu', 'novylink_admin_bar_link',25);\n<\/pre>\n\n\n\n

P\u0159id\u00e1n\u00ed submenu do admin baru<\/h2>\n\n\n\n

Pro p\u0159id\u00e1n\u00ed submenu roz\u0161\u00ed\u0159\u00edme p\u0159edchoz\u00ed funkci<\/p>\n\n\n\n

function add_novylink_admin_bar_link() {\n\tglobal $wp_admin_bar;\n\tif ( !is_super_admin() || !is_admin_bar_showing() )\n\t\treturn;\n\t$wp_admin_bar->add_menu( array(\n\t'id' => 'novy_link',\n\t'title' => __( 'Novy link'),\n\t'href' => __('http:\/\/novylink.com'),\n\t) );\n\n\t\/\/ P\u0159id\u00e1n\u00ed submenu odkaz \"Zobrazit v\u0161echny \u010dl\u00e1nky\"\n\t$wp_admin_bar->add_menu( array(\n\t\t'parent' => 'novy_link',\n\t\t'id'     => 'novy_vse',\n\t\t'title' => __( 'Zobrazit v\u0161echny \u010dl\u00e1nky'),\n\t\t'href' => __('http:\/\/novylink.com\/vse'),\n\t));\n\n\t\/\/ P\u0159id\u00e1n\u00ed submenu odkaz \"St\u00e1hnout\"\n\t$wp_admin_bar->add_menu( array(\n\t\t'parent' => 'novy_link',\n\t\t'id'     => 'novy_stahnout',\n\t\t'title' => __( 'St\u00e1hnout'),\n\t\t'href' => __('http:\/\/novylink.com\/stahnout'),\n\t\t'meta'   => array(\n\t\t\t'class' => 'st_menu_download',),\n\t));\n\t\t$wp_admin_bar->add_menu( array(\n\t\t\t'parent' => 'novy_stahnout',\n\t\t\t'id'     => 'novy_nestahnout',\n\t\t\t'title' => __( 'Nestahnout'),\n\t\t\t'href' => __('http:\/\/novylink.com\/nestahnout'),\n\t\t));\n}\nadd_action('admin_bar_menu', 'add_novylink_admin_bar_link',25);\n<\/pre>\n\n\n\n

P\u0159idali jsme submenu do admin baru, v p\u0159\u00ed\u0161t\u00edm \u010dl\u00e1nku si uk\u00e1\u017eeme, jak zobrazit admin bar pouze n\u011bkomu, \u010di ho \u00fapln\u011b skryjeme.<\/p>\n\n\n\n

P\u0159e\u010dt\u011bte si tak\u00e9 \u010dl\u00e1nek Jak odstranit polo\u017eky z admin baru<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

V dne\u0161n\u00edm \u010dl\u00e1nku nav\u00e1\u017ei na p\u0159edchoz\u00ed, ve kter\u00e9m jsme z admin baru odstranili odkazy a dnes si uk\u00e1\u017eeme jak naopak odkazy do admin baru m\u016f\u017eeme p\u0159idat. P\u0159id\u00e1me nejprve jeden odkaz, n\u00e1sledn\u011b vytvo\u0159\u00edme drop down menu a nakonec je\u0161t\u011b jedno submenu. M\u016f\u017eeme si tak do admin baru p\u0159idat odkazy na r\u016fzn\u00e1 nastaven\u00ed plugin\u016f, theme options, zkr\u00e1tka<\/p>\n","protected":false},"author":1,"featured_media":8624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[63,64],"class_list":["post-9820","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","tag-admin-bar","tag-admin-bar-submenu"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/9820"}],"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=9820"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/9820\/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=9820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=9820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=9820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}