How can I changing/ adding code of the Themes with a wordpress plugin? Example: Adding before or after the comments-forms a few lines.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You will need action hooks in your themes. These hooks allow you to add content where the hooks are locating via a plugin, or a child theme.
Thesis and Thematic are WordPress themes with action hooks. Although it’s easy to add action hooks to your own theme.
In the theme, add
do_action('your_hook_name'). For example, in thecomments.phpfile:Now, in your plugin/child theme, add, for example,
. This means we're adding the
commenting_rules()function to the hookafter_comments_form.The
commenting_rules()function could look like:Be sure you add the
add_action()function below thecommenting_rules()function.Themeshaper (the creator of the Thematic) has a great article on that. Nathan Rice has also written a post explaining action hooks.