前端帖子提交
-
-
您能解释一下用例吗?有很多选择,但是对于所有用例,都不是建议的.Can you explain your use-case? There are many options but some are not ones to suggest for all use cases.
- 0
- 2010-12-27
- MikeSchinkel
-
将您的问题标题从Fron-End修改为Frontend或Front-End.fix your question title from Fron-End to Frontend or Front-End.
- 1
- 2010-12-28
- Philip
-
查看这个非常酷且易于遵循的教程,以了解如何从前端发布信息(包括照片画廊和自定义字段!). [vudu.me/postreview](http://vudu.me/postreview)Check out this very cool and easy to follow tutorial on how to post from the front end (including photo galleries and custom fields!!). [vudu.me/postreview](http://vudu.me/postreview)
- 0
- 2011-06-27
- trusktr
-
您可以使用本教程中的代码段来创建一个简单的WP前端发布插件:[http://www.cozmoslabs.com/5528-wordpress-post-from-front-end/](http://www.cozmoslabs.com/5528-wordpress-post-from-front//You can use the code snippets from this tutorial to create a simple WP Front End Posting plugin: [http://www.cozmoslabs.com/5528-wordpress-post-from-front-end/](http://www.cozmoslabs.com/5528-wordpress-post-from-front-end/)
- 0
- 2013-02-12
- Adrian Spiac
-
2 个回答
- 投票数
-
- 2010-12-28
<?php $postTitle = $_POST['post_title']; $post = $_POST['post']; $submit = $_POST['submit']; if(isset($submit)){ global $user_ID; $new_post = array( 'post_title' => $postTitle, 'post_content' => $post, 'post_status' => 'publish', 'post_date' => date('Y-m-d H:i:s'), 'post_author' => $user_ID, 'post_type' => 'post', 'post_category' => array(0) ); wp_insert_post($new_post); } ?> <!DOCTYPE HTML SYSTEM> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled Document</title> </head> <body> <div id="wrap"> <form action="" method="post"> <table border="1" width="200"> <tr> <td><label for="post_title">Post Title</label></td> <td><input name="post_title" type="text" /></td> </tr> <tr> <td><label for="post">Post</label></td> <td><input name="post" type="text" /></td> </tr> </table> <input name="submit" type="submit" value="submit" /> </form> </div> </body> </html>
我在 Themeforest 上找到了它很好,
您可以为此做很多事情,您必须添加一些额外的代码来检查用户是否已登录或您想做什么,另一方面,您必须在WordPress插件存储库中进行搜索,以找到一些很棒的插件,
搜索"前端"希望有帮助
<?php $postTitle = $_POST['post_title']; $post = $_POST['post']; $submit = $_POST['submit']; if(isset($submit)){ global $user_ID; $new_post = array( 'post_title' => $postTitle, 'post_content' => $post, 'post_status' => 'publish', 'post_date' => date('Y-m-d H:i:s'), 'post_author' => $user_ID, 'post_type' => 'post', 'post_category' => array(0) ); wp_insert_post($new_post); } ?> <!DOCTYPE HTML SYSTEM> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled Document</title> </head> <body> <div id="wrap"> <form action="" method="post"> <table border="1" width="200"> <tr> <td><label for="post_title">Post Title</label></td> <td><input name="post_title" type="text" /></td> </tr> <tr> <td><label for="post">Post</label></td> <td><input name="post" type="text" /></td> </tr> </table> <input name="submit" type="submit" value="submit" /> </form> </div> </body> </html>
I found this at Themeforest it's working fine,
you can do a lot of things with this, you have to add some extra code to check if a user is logged in or whatever you want to do,In the other hand you have to search in the WordPress plugins repo to find out some great plugins,
Search for "frontend"hope it helps
-
@Philip:我尝试了此操作,但收到以下错误:解析错误:解析错误,意外的';',期望/home/www/web21/html/tornfraua/wp-admin/custom-post-new.php中的')'在第10行@Philip: I tried this but get the following error: Parse error: parse error, unexpected ';', expecting ')' in /home/www/web21/html/tornfraua/wp-admin/custom-post-new.php on line 10
- 0
- 2011-02-03
- RoflcoptrException
-
@Roflcoptr,从第10行中删除关闭的'?>',就可以了!@Roflcoptr, remove the close '?>' from line 10 and it will be fine!
- 1
- 2011-02-03
- Philip
-
有什么方法可以整合类别下拉列表?Is there any way to Integrate the category drop-down list?
- 0
- 2011-02-07
- Towfiq
-
@Towfiq-是的,但是我不能在注释中写代码,您必须提出一个新问题!@Towfiq - Yes, but i can't write at the comments the code, you have to make a new question!
- 0
- 2011-02-08
- Philip
-
@Philip您可以使用http://pastebin.com/@Philip can you use http://pastebin.com/
- 0
- 2011-02-12
- Towfiq
-
我正在尝试做与此类似的事情–唯一的事情是,我正在使用自定义帖子类型和自定义分类法. 我无法获得保存数据的类别信息,其他所有东西都保存在数据库中就好了. 任何人都有答案或只是猜测什么可能出问题了?I'm trying to do something similar to this — only thing is, that I'm using a Custom Post Type and a custom taxonomy. I can't get the category thing to save the data — everything else saves in the database just fine. Anyone has a answer or just a guess to what could be wrong?
- 0
- 2011-06-07
- stffn
-
- 2011-02-24
哈哈,那是我的教程严重失败.抱歉,这是我写的,因为我从未遇到过其他人遇到的404问题.
我通常使用的前端帖子形式在模式窗口中打开,例如,我为 http://制作的帖子形式wphonors.com 已加载到thickbox弹出窗口中,我相信这就是为什么我对此从未遇到过问题.我可以对表单进行任何所需的操作,包括ajax提交,将提交重定向到已提交的帖子,或者仅显示一条消息并转到随机页面.
由于无法顺利完成本教程,我有很好的意图:)
也许尝试使用thickbox加载它们,这确实非常简单.我仍在研究后续教程,以赎回失败的内容,但是很难像大多数人可能在其站点中实现它的方式那样使它工作.
Haha, that's my tutorial that failed badly. Sorry bout that, it was something I wrote because I never had the 404 issue everyone else had with it.
The frontend post forms I use most times open up in a modal window, for example, the post forms I made for http://wphonors.com are loaded in the thickbox popup thing, which I believe is why I never had an issue with this. I was able to do anything I wanted with my forms, ajax submit, on submit redirect to submitted posts, or just show a message and go to a random page.
My bad on failing with that tutorial, I had good intentions :)
Maybe try loading them using thickbox, it's really very simple to do. I'm still working on a follow up tutorial to redeem that failed on, but it's been hard to make it work the way most people would be likely to implement it in their sites.
我正在尝试添加一个表单,以便用户可以从前端提交帖子.
我正在关注本教程: http://wpshout.com/wordpress-submit-posts-from-frontend/
我正在做的是将此代码添加到我的一个页面中-模板.表单显示正常,但是当我单击"提交"按钮时,它提示我" 找不到页面错误"
许多评论者说它不起作用. 谁能指出我正确的方向?代码不完整吗?有缺陷吗?我在做错什么吗?
谢谢
Towfiq I.