{"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
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\nP\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\nP\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