我想现在如果有任何方法来改变管理子菜单分类的级别(作为类别和标签)从帖子使其作为父菜单(如页面,评论...)WordPress的:移动管理子菜单从帖子到父级
回答
好的,我不知道我是否让你100%正确...你改变了默认“post”的名称和附加值!?
也许会更好引进了自定义后类型为,但正如之前所说的,不会与子菜单中更改问题...
如果你的客户为例想要这样的说法,在这里我们走了,我测试了这个解决方案,它工作得很好,当然,你可能需要做一些造型:
function load_custom_wp_admin_style() { ?>
<script>
jQuery("#menu-posts ul li:nth-of-type(4)").prependTo("#adminmenu");
jQuery("#menu-posts ul li:nth-of-type(4)").prependTo("#adminmenu");
</script>
<?php }
add_action('admin_footer', 'load_custom_wp_admin_style');
我将此代码添加到我的functions.php这个感动“类别”和的“标签”在“dashbord”之前,将帖子类型“帖子”添加到管理菜单的顶部!
如果你的“仪表板”后,希望尝试使用:
function load_custom_wp_admin_style() { ?>
<script>
jQuery("#menu-posts ul li:nth-of-type(4)").insertAfter("#menu-dashboard");
jQuery("#menu-posts ul li:nth-of-type(4)").insertAfter("#menu-dashboard");
</script>
<?php }
add_action('admin_footer', 'load_custom_wp_admin_style');
如果您使用的不是帖子型“上岗”你必须改变选择“#菜单的帖子”,只是看它在检查员!
编辑关于你的最后一页评论:
如果你想要做一些造型永远不要改变WordPress的核心管理,CSS,你将失去每WordPress的更新这些变化!
但是你可以CSS以同样的方式就像我们所插入的脚本等,即通过CSS背景添加一个图标像这样通过你的函数中插入样式:
function load_custom_wp_admin_style() { ?>
<script>
// I add an id to the element so it can be selected more easily for styling...
jQuery("#menu-posts ul li:nth-of-type(5)").attr('id', 'custom_tag_link');
// Here I change the position as done before...
jQuery("#menu-posts ul li:nth-of-type(5)").insertAfter("#menu-dashboard");
jQuery("#menu-posts ul li:nth-of-type(4)").attr('id', 'custom_cat_link');
jQuery("#menu-posts ul li:nth-of-type(4)").insertAfter("#menu-dashboard");
</script>
<style>
/* Here comes the styling... */
/* Do some margins/paddings and background-alignments... */
#custom_cat_link, #custom_tag_link {
background-size: auto 100%;
background-repeat: no-repeat;
padding-left: 25px !important;
margin: 10px !important;
}
/* Set your Icons here... */
#custom_cat_link {
background-image: url('https://cdn0.iconfinder.com/data/icons/customicondesignoffice5/256/examples.png');
}
#custom_tag_link {
background-image: url('https://cdn0.iconfinder.com/data/icons/customicondesignoffice5/256/examples.png');
}
</style>
<?php }
add_action('admin_footer', 'load_custom_wp_admin_style');
第二件事:重命名...正如前面提到的,我不会改变帖子类型“发布”,更好的做法是引入一个自定义帖子类型,你可以根据你的需要和他们的分类法命名它们,但我想你不想改变那现在,我们又一次用JS的“不洁的hack-like”方式......全码:
function load_custom_wp_admin_style() { ?>
<script>
// I add an id to the element so it can be selected more easily for styling...
jQuery("#menu-posts ul li:nth-of-type(5)").attr('id', 'custom_tag_link');
// Change the name of the <a>-element in the <li>-elem here...
jQuery("#menu-posts ul li:nth-of-type(5) a").html('NEW TAG TITLE');
// Here I change the position as done before...
jQuery("#menu-posts ul li:nth-of-type(5)").insertAfter("#menu-dashboard");
jQuery("#menu-posts ul li:nth-of-type(4)").attr('id', 'custom_cat_link');
jQuery("#menu-posts ul li:nth-of-type(4) a").html('NEW CAT TITLE');
jQuery("#menu-posts ul li:nth-of-type(4)").insertAfter("#menu-dashboard");
</script>
<style>
/* Here comes the styling... */
/* Do some margins/paddings and background-alignments... */
#custom_cat_link, #custom_tag_link {
background-size: auto 100%;
background-repeat: no-repeat;
padding-left: 25px !important;
margin: 10px !important;
}
/* Set your Icon here... */
#custom_cat_link {
background-image: url('https://cdn0.iconfinder.com/data/icons/customicondesignoffice5/256/examples.png');
}
#custom_tag_link {
background-image: url('https://cdn0.iconfinder.com/data/icons/customicondesignoffice5/256/examples.png');
}
</style>
<?php }
add_action('admin_footer', 'load_custom_wp_admin_style');
在这里你可以看到在行动的整个事情:
,您可以更改高会出现一个菜单,但我敢肯定,你不能改变一个子菜单的水平,因为例如这些类别属于帖子类型“帖子”,因为每个分类法属于它们被定义的帖子类型...
您可以设置otion网页,或自定义文章类型,但第一个也不会inculde分类,第二个不是直接的,也只是作为一个子菜单...
无论如何,也许你能做到所以用java脚本改变管理屏幕的dom,但我不会推荐这样做!这项任务是否有特定的原因?
在这里,您可以看到如何包括管理屏幕上的自定义JS: HTTPS://codex.wordpress .org/Plugin_API/Action_Reference/admin_enqueue_scripts 因此,你可以添加一个脚本,“移动”的链接,即通过jquery ......但正如我所说我不会推荐这个,因为它不会让我觉得这么多sence! – ToTaTaRi
Txs为您的答案。我添加了一张图片,解释了我在下面说的 –
- 1. 将标准帖子菜单移动到自定义管理菜单
- 2. 使用PHP/WordPress从子菜单设置父级菜单CSS类
- 3. WordPress的管理菜单帖子链接失踪
- 4. 从菜单wordpress中排除帖子
- 5. jQuery的hoverIntent子从子菜单移动到主菜单
- 6. Wordpress将子帖子添加到子菜单
- 7. WordPress的从管理菜单
- 8. WordPress的如何删除顶层管理菜单的子菜单
- 9. wordpress foundation手风琴移动子菜单
- 10. WordPress的最新帖子菜单项
- 11. WordPress的垂直菜单使用帖子
- 12. ActionBarsharlock:从子菜单从菜单移动到另一个活动
- 13. wordpress管理菜单。子菜单的命名
- 14. 的Joomla子菜单管理
- 15. WordPress管理显示0帖子
- 16. 在wordpress的父母帖子页面上显示子帖子
- 17. WordPress的多个帖子从帖子ID
- 18. 从循环中删除父级帖子
- 19. 插件子菜单管理
- 20. WP管理菜单中的多个Wordpress自定义帖子类型
- 21. 如何在WordPress管理子菜单中创建多个子菜单?
- 22. 拉伸子菜单到父级菜单大小
- 23. Wordpress子菜单
- 24. 动态CSS下拉菜单显示与父级相同级别的子菜单
- 25. 自定义帖子类型不出现在WordPress管理菜单中
- 26. 如何从Wordpress的父类别中排除子帖子?
- 27. 的WordPress:如何显示子菜单中的父菜单
- 28. WordPress的 - 在单个帖子页面(循环外)获取帖子偏移量/帖子页面偏移量
- 29. CSS:移动菜单子菜单问题
- 30. WordPress的管理员搜索帖子错误 - 无效的帖子类型
Ups,我刚刚注意到,以这种方式改变了分类和标签的顺序,试着避免这种情况:jQuery(“#menu-posts ul li:nth-of型(5) “)insertAfter(” #菜单的仪表板“); jQuery(“#menu-posts ul li:nth-of-type(4)”)。insertAfter(“#menu-dashboard”); – ToTaTaRi
非常有帮助,非常感谢...我想知道是否有添加图标和编辑字体的方式,因为我尝试在wp-admin/css/admin-menu.css中执行该操作,但没有任何更改! –
还有一件重要的事情:如何重命名它们? –