This release is a major rewrite of the plugin code. A number of features have been added, some of these include widget support, hooks for theming, the ability to have unregistered users post (using recaptcha [recommended, but not required]). More documentation at the end of this post.
Skip to developer documentation?
Why should you use this plugin?
- User reviews on a niche market site.
- A suggestion box – in combination with a voting plugin, you can find out what your community thinks is important
- Any user-submitted content – you can create a very basic ‘forum’ with this.
Known issues:
- Specifying category to post to is not working
- Conflict with Verve Meta Boxes (only when debug is on)
- No focus notification/cursor on inputs (webkit only)
User Documentation
There are 3 ways to include this plugin into your site.
- Shortcode
- To include the form in a page (like the example screenshot in the plugin directory), use this method. Learn more about shortcodes?
[post-from-site]
This will insert the post form right in the page where you put the code. The settings you can change are:popup
whether this is a popup, defaults to false.link
if it is a popup, this is what the link should say.cat
restrict posts to a single category, currently not working.
- Widget
- To include the form in a sidebar, footer, or anywhere else you can put widgets, use the Post From Site widget. How do I use widgets?
- PHP code
- Post From Site is now a class, which means the function we were using before is outdated. This code should go in your theme files. Start here to learn about customizing/creating a theme.
<?php $pfs = new PostFromSite(0, 'write a post', true, ''); $pfs->form(); ?>
Here, the form defaults to being a popup (as opposed to the shortcode and widget, where they default to not being a popup). The parameters are the same as in the shortcode- but the first is the ID of the form you’re using, which will always be zero if you’re using 3.x (it’s a future feature). Next is the link text, then whether it’s a popup, and finally if you’re restricting the category.
Developer Documentation
One major improvement to this version is the addition of hooks. Unless otherwise specified, these are all filters.
pfs_default_link_text
- run over default link text for ‘click to post’ link, only appears if PFS is a popup and there is no default text defined.
pfs_before_form
pfs_form_start
pfs_before_submit
pfs_form_end
pfs_after_form
pfs_alert_login
- All these are passed empty strings, and should be used if you have extra information you want to include. Currently they also pass the $idtext which is used to differentiate between multiple forms on a page.
pfs_alert_login
- This filter is run over the warning shown when user login is required.
pfs_taxonomy_label
- Run over the label for each taxonomy
pfs_{$taxonomy}_list
- run on the full taxonomy select list before it’s returned to be displayed.
pfs_theme_css
- Run over the URL to the CSS styling the form, hook into this to change the stylesheet used.
function my_theme_pfs_style( $url ){ return "your stylesheet URL"; } add_filter( 'pfs_theme_css', 'my_theme_pfs_style' );
If you have any issues or questions, please post to the forum.
I desperately want to have the Visibility of the posts default to Private. Is there any way to hack that in? My couple (weak) attempts were fruitless… That might make a nice admin option sometime, but I’m looking for it to be stuck that way.
Thanks!