/** * Zpracování metaboxu pro archivy post typů v menu * NENÍ POTŘEBA VOLAT VEŘEJNĚ * * @author Martin Hlaváč * @link http://www.ktstudio.cz * * @param string $html */ public function postArchivesMenuMetaBoxCallBack() { $postTypes = get_post_types(array("show_in_nav_menus" => true, "has_archive" => true), "object"); if (KT::arrayIssetAndNotEmpty($postTypes)) { foreach ($postTypes as $postType) { $postType->classes = array(); $postType->type = "custom"; //$postType->name; $postType->object_id = $postType->name; $postType->title = $postType->labels->name; $postType->description = $postType->labels->name; $postType->object = self::POST_TYPE_ARCHIVE_OBJECT_KEY; $postType->menu_item_parent = null; $postType->parent = null; $postType->db_id = null; $postType->url = get_post_type_archive_link($postType->name); $postType->target = null; $postType->attr_title = $postType->labels->name; $postType->xfn = null; } $walker = new Walker_Nav_Menu_Checklist(array()); KT::theTabsIndent(0, "<div id=\"kt-archive\" class=\"posttypediv\">", true); KT::theTabsIndent(1, "<div id=\"tabs-panel-kt-archive\" class=\"tabs-panel tabs-panel-active\">", true); KT::theTabsIndent(2, "<ul id=\"kt-archive-checklist\" class=\"categorychecklist form-no-clear\">", true); KT::theTabsIndent(3, walk_nav_menu_tree(array_map("wp_setup_nav_menu_item", $postTypes), 0, (object) array("walker" => $walker)), true); KT::theTabsIndent(2, "</ul>", true); KT::theTabsIndent(1, "</div>", true); KT::theTabsIndent(0, "</div>", true, true); $addMenuTitle = htmlspecialchars(__("Přidat do menu", "KT_CORE_DOMAIN")); KT::theTabsIndent(0, "<p class=\"button-controls\">", true); KT::theTabsIndent(1, "<span class=\"add-to-menu\">", true); KT::theTabsIndent(2, "<input type=\"submit\" id=\"submit-kt-archive\" name=\"kt-add-archive-menu-item\" class=\"button-secondary submit-add-to-menu\" value=\"{$addMenuTitle}\" />", true); KT::theTabsIndent(1, "</span>", true); KT::theTabsIndent(0, "</p>", true, true); } else { KT::theTabsIndent(0, KT_EMPTY_SYMBOL, true, true); } }