or should I create a plugin ? if it’s the case, why ?
Yes you should: Separation of concerns. A theme is the view of the application. As the facebook functionality is part of your application, it belongs into a plugin.
You have one large benefit from moving stuff into plugins: If you exchange your theme, you can easily switch themes without loosing the functionality and having to code all that again.
And always use hooks and (even better) filters to bring stuff into templates. Hooks like the_content
, start_loop
, end_loop
and the_post
are perfect for attaching plugin output to the view. And they’re present per default as core injects them into loops.
Related Posts:
- Merge comments from Facebook with WP comments [closed]
- How to rearrange fields in comment_form()
- Is it possible to pull comments from facebook into your blog?
- Removing the “Website” Field from Comments and Replies?
- How to add a class to the comment submit button?
- How to display comment form error messages in the same page
- A plugin where users can comment with Facebook or Twitter or OpenID [closed]
- Deep customization of the comment form?
- Using filter to add additional fields to comment_form()
- Why are default comments deprecated?
- Comments Reply Form
- Does WordPress Allow Blank/Empty Comment Submissions In WordPress?
- Comment form not showing up without comments
- Programmatically block commenting by restricting view of comment form
- How can comments be submitted when I don’t have a comment box on a page?
- Custom Field Added In Comment Form Not Showing In Edit
- Add a drop down list to comment form?
- How To Remove The “Click here to cancel reply” Link From The WordPress Comment Form
- Making a Comment on a page without being on that page?
- customize comment form
- How to save new comment as custom comment type?
- WP comments form (custom) is displaying an extra comment field
- How to add consent checkbox in comment section
- How to add enctype to multipart/form-data to comment form?
- Changing position of cancel_comment_reply_link and other elements of comment form
- Edit Comment_Field while using T5 Comment Textarea On Top-Plugin
- Share comment to twitter after publishing [closed]
- Disable comments
- How to add attributes to the comment form tag?
- Comment form connection to Gravity Forms
- Auto-fill Custom comment fields
- The comment login form is visible to me but not to the user
- Change order of comment fields
- Create comments.php form of custom HTML code
- How can I test why the comment hook is not working?
- comment_post action hook running on page load instead of after a comment is posted
- API Hook for After Commenting (for sharing on Facebook)
- Add class to comment form div when comment-reply button is clicked
- To whom do emails get sent via the WordPress comments form?
- Display complete comment section via post ID
- Notification if Comment Author Field is left empty. E.g. change input border colour
- Assign author to comment from post edit page
- How to retain comment text on comment form after login/registration?
- Check if comment was successfully submited
- Ajax submit comments
- Show Social Sharing Buttons And Facebook Comments In Lightbox Modal Dialog (Image Overlay)?
- Why could my comment_form variable not be working?
- comment_notes_before not working
- Add comment_meta to wp_comment_reply
- How to create post comment from different domain
- Are there some caveats for using guids for FB comments
- Comments on future posts
- unsetting required fields in the comment reply form
- Returning error upon comment being flagged as spam
- Facebook comments widget – App ID
- How to filter comments by comment_meta
- Changing the Comment Fields using Filter (without success)
- Custom sort comments with select form
- Edit Comments Fields
- Same comment section on every page
- Update post “A” on comment submition on post “B”
- Upload avatar for post comment
- How to display replies to his comments in user profile of current user
- reply comment below the comment box without reload page
- Comment author profile image
- Force to show all fields in comment forms to the logged-in users
- Top rated posts Average rating issue
- Comment Form Fields when user logged in
- Author name length character limit?
- Check if comment author has url
- How to make comment reply available only for login members of a certain user roles only?
- How to call out the date of user’s first comment?
- How to pass settings to comment_form() if theme only uses comments_template()?
- How to add a class to comment submit button?
- WordPress Commenting System User access and Security
- Comments.php is not getting called on main blog page
- How to enable truly anonymous posting in bbPress forums? [closed]
- Comment section not appearing on posts
- reply to comment excerpt instead of author in comment title
- How to change comment-page-1#comment-25 to any string?
- Adding restrictions to open comments
- wp-editor-area textarea disapear on cancel-comment-reply-link click
- Comment form – different title if no comment yet
- Display Comment Form on dedicated Page for each post
- WordPress Comments jQuery Doesn’t submit
- Commentform – Hightlight invalid fields instead of prompting towards error page
- Insert comment and still use moderation
- Need an advice about comments
- How to remove website field in comment form?
- Display facebook comments made on site
- Actual comments not showing, but form is?
- add field comment [duplicate]
- How to remove or customize “Comment” in comments form?
- Embed a page within WordPress dashboard?
- How do I convert users who put an email and username for a comment into registered users? [duplicate]
- Outputting complete custom comment form
- Clicking Comment “Reply” Button only replies to first comment
- prevent duplicate comments using wp_insert_comment
- How to hide and disable URL and email fields from comments?
- Show success message on comment submit when email and name is not required field