wordpress后台添加post文章管理选项


在wordpress主题开发中常常会需要用到多个文章分类管理及目录;
下面给大家分享一段添加post函数的方法

16171819202122add_action('init', 'my_post_type_mytype');function my_post_type_mytype() {register_post_type( 'mytype',array( 'label' => __('Mytype', 'My theme name'), 'public' => true, 'show_ui' => true,'show_in_nav_menus' => false,'menu_position' => 5,'rewrite' => array('slug' => 'services-view','with_front' => FALSE,),'supports' => array('title','thumbnail','editor')) );}


前台调用方法

12345678//调用$args = array('post_type' => 'Mytype','numberposts' => $num,//取到数量,其他参数可以查看 get_posts() 函数)$posts = get_posts($args);

上一篇:无需插件通过代码函数来增强wordpress编辑器

下一篇:Prism.js非插件代码语法高亮


Copyright © 2002-2019 测速网 https://www.inhv.cn/ 皖ICP备2023010105号 城市 地区 街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!
热门搜索