我不知道这个话题可能会涉及到其他地方。但我试图找到一步一步简单的教程。做一个插件,我可以添加一个新的网页到网站。在那一页里我放了一些表格。只有注册用户才能访问。
我设法在管理端制作了插件。但无法找到在网站前端制作表格的教程。仅供注册用户使用。
请给我一些链接。
我的核心问题是
提前谢谢。
发布于 2011-07-22 12:30:10
如何在前端的一个页面中显示自定义编码的php表单?
最好的方法是创建一个自定义页面模板,然后在WordPress管理中创建一个页面,并为该页面选择新创建的模板。
我怎样才能使该网页仅限于注册用户?
通常,我会使用插件用户特定内容,但是由于您正在寻找没有插件的解决方案,所以您可以在自定义模板页面中使用is_user_logged_in()函数来检查用户是否登录。
如何自定义登录/注册表单以添加自定义字段而不使用任何插件?
看看这个不错的教程
发布于 2021-08-06 13:00:12
对于没有插件的自定义表单。您可以在重新定向到新页面之前使用wordpress中的现有钩子,如template_redirect.This钩子调用。您可以参考一篇深入的文章这里。
html表单
<div class="employee">
<input type="hidden" name="show_msg">
<form name="customer_details" method="POST" required="required" class="input-hidden">
Your Name: <input type="text" id="name" name="customer_name">
Your Email: <input type="text" id="email" name="customer_email">
Company: <input type="text" id="company" name="company">
Sex: <input type="radio" name="customer_sex" value="male">Male <input type="radio" name="customer_sex" value="female">Female
<textarea id="post" name="experience" placeholder="Write something.." style="height:400px;width:100%"></textarea>
<input type="submit" value="Submit">
<!--?php wp_nonce_field( 'wpshout-frontend-post','form-submit' ); ?-->
</form></div>function wpshout_frontend_post() {
wpshout_save_post_if_submitted();
}
add_action('template_redirect','wpshout_frontend_post', 2);发布于 2011-07-22 13:41:15
为窗体添加一个短代码也是一个选项:http://codex.wordpress.org/Shortcode_API接口
https://wordpress.stackexchange.com/questions/23747
复制相似问题