WordPress 的公共帖子表单
您好,我正在寻找一种非常简单快速(尽管没有插件)的方法来在页面模板内添加表单,该模板将允许登录用户从 WP-Admin 外部发布。所以基本上该帖子将位于登录的作者之下。
我一直在网上寻找一些教程等,但没有太多运气,许多人似乎想选择插件等。
任何人都可以帮忙吗?谢谢。
Hi I'm looking for a very simple quick (no-plugins though) way to add a form inside a page template that will allow a logged-in user to post from outside WP-Admin. So basically the post will be under the logged-in author.
I have been looking around the web for some tutorials etc but haven't had too much luck and many seem to want to opt for plugins etc.
Can anyone help thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
wp_insert_post()
函数。看看这个。例如,您可以将其粘贴到
category.php
中,然后访问类别页面并检查它。但请确保将顶部代码放在get_header()
函数上方。--
有关更多信息,您应该看看这里 带有表单的 wp_insert_post
好运气
You can use the
wp_insert_post()
function.take a look at this. you can paste it in
category.php
for example and visit a category page and check it. but make sure to put the top code above theget_header()
function.--
for more info you should take a look here wp_insert_post with a form
good luck
如果您不介意更改主题,您可能想尝试 P2: http://wordpress.org/扩展/主题/p2
这里还有一个实际操作的视频:http://p2theme.com/
P2 允许人们直接从主页,这似乎是您正在寻找的内容。
If you don't mind changing your theme, you might want to try P2: http://wordpress.org/extend/themes/p2
There's also a video of it in action here: http://p2theme.com/
P2 allows people to post straight from the home page, which seems like what your looking for.