我正在为wordpress开发一个插件 . 这个插件必须有一个用于插件设置的管理部分,但也必须有一个带表单的自定义前端页面 .
我是wordpress插件开发世界的新手,但我还没有找到有关此任务的具体信息 .
有没有办法从插件添加页面到前端,还是需要手动编辑当前模板并添加页面?
我认为您在管理设置页面中寻找此项https://codex.wordpress.org/Function_Reference/add_options_page
Fot前端,我建议创建一个带有模板的页面https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
以下是在创建插件时在前端页面上添加自定义内容的方法:http://blog.frontendfactory.com/how-to-create-front-end-page-from-your-wordpress-plugin/
function elegance_referal_init() { if(is_page('share')){ $dir = plugin_dir_path( __FILE__ ); include($dir."frontend-form.php"); die(); } } add_action( 'wp', 'elegance_referal_init' );
2 回答
我认为您在管理设置页面中寻找此项https://codex.wordpress.org/Function_Reference/add_options_page
Fot前端,我建议创建一个带有模板的页面https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
以下是在创建插件时在前端页面上添加自定义内容的方法:http://blog.frontendfactory.com/how-to-create-front-end-page-from-your-wordpress-plugin/