当前位置:
测速网 >
cms教程 > 发布时间:2023-09-28 09:30 文章来源于网友投稿,仅供参考!
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非插件代码语法高亮