Hooking into Comments
- 18. • Replying to another comment
• Comments open/closed?
• Registration Required?
• wp_login_form()!
• User Logged In?
• Previously entered name/email/URL
• Standardized actions/filter
- 21. title_reply
Filters
comment_notes_before
{ comment_form_default_fields
}
comment_field
comment_notes_after
label_submit
- 22. Actions
comment_form_before
comment_form_must_log_in_after
comment_form_top
comment_form_logged_in_after
comment_form_before_fields
comment_form_after_fields
comment_form
comment_form_after
comment_form_comments_closed
- 23. comment_form_before
Actions
comment_form_before_fields
comment_form_after_fields
comment_form
comment_form_after
- 42. Beau Lebens
@beaulebens
beau@automattic.com
dentedreality.com.au
Editor's Notes
- Mark’s talk -- hooks/actions
Theme developers?
Plugins that work with comments?
Copy-paste the comments form
Comment form from Twentyten
-
-
- Kubrick
43 Lines
- Logic, needs to be repeated on each theme
if the user is logged in,
if comments are enabled, etc
- Twentyten
- Same logic, different theme!
-
-
-
-
-
-
- Twentyten
-
-
-
-
-
-
- Others available: what happens when logged in?
When not logged in and registration is required?
When replying to another message
-
-
-
-
-
-
-
-
-
- Hook in and save in commentmeta!
add_action( ‘wp_insert_comment’ ) + save into $_SESSION
-
-
- wp_options to enable the “feature” and how often to show it
- Add the message to the top of the form
- Add a hidden field to save against the comment to know who “won”
-
- Don’t forget to hook into comment submission and save in commentmeta
add_action( ‘wp_insert_comment’ )
-
-
-
-