Changes in comment form
-
This can all be accomplished with a child theme. The only one I’m not totally sure about is #1.
Download an empty Ignite child theme.
1. Can you tell me how to change that text “You must be logged in to post a comment”? when I am clicking on it for registration it is redirecting me to wordpress registration page but I am using buddypress to register. I want it must redirect to buddypress registration page.
I’m not that familiar with Buddypress, so you may want to repost this question on their support forum. However, I can tell you how to change the text and the URL to anything you’d like.
In Ignite, there is a
comments.phpfile. If you copy this entire file into a child theme, that copy will be used instead, so you can edit it as much as you’d like. The comment form has a few parameters (codex article) including one calledmust_log_in. You can set a variable incomments.phpthat defines the themust_log_inparameter as any link/text you’d like, and then pass that variable into thecomment_form()function.That would work for changing the login URL. I’m just not sure if it’s the right way to do it for Buddypress. They may have a login override setting or hook for that.
2. Tell me how I can remove “enter a comment…” from text area field box.
You can add the following function to your child theme and modify it how you see fit:
function ct_ignite_my_update_comment_field($comment_field) { $comment_field = '<p class="comment-form-comment"> <label class="screen-reader-text">' . __('Your Comment', 'ignite') . '</label> <textarea required placeholder="' . __('Enter Your Comment', 'ignite') . '…" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea> </p>'; return $comment_field; } add_filter('comment_form_field_comment','ct_ignite_my_update_comment_field', 999);That’s the current output. There’s a
placeholderattribute in there that you can remove.3. how I can change post a comment button ?
You can edit the text in the submit button by setting another parameter in the
comment_form()function in yourcomments.phpfile.Example:
<?php comment_form(array('label_submit' => 'Click Me')); ?>That would change the submit button to say, “Click Me”. Coupled with your change to the login url, it would look something like this:
<?php comment_form(array('label_submit' => 'Do Whatever', 'must_log_in' => $my_variable;)); ?>Okay, I hope that helps you get things just the way you want, but we can discuss the implementations with more detail if you’d like.
hi thanks for getting back.
Its too much for me. Can u do me a favour. earlier I was not aware the use of child theme so I made some changes in core theme in comment.php.
If I will share with you the whole coding and requirement so will u please provide amended code so I will put that in child theme.
plz help me out. its very necessary.
Ah okay. Here is a child theme with the updates I shared in this post.
The function in
functions.phpwill remove the placeholder for you automatically. In thecomments.phpfile you will see the other customizations on lines 23-26. The$new_login_urlis currently set to the default value, and the submit button label is set to “Submit Button”. You can change both of these to whatever you’d like.To activate the child theme:
- Visit your site’s dashboard
- Go to the Appearance menu
- Click on the “Add New” button at the top of the page
- Click on the “Upload Theme” button at the top of the page
- Click on the “Choose File” button
- Select the tracks-child.zip file you downloaded from the link above
- Click the blue “activate” link
You may have to reselect your menu locations after activating the child theme, but that should do the trick.
Thanks for your quick response and will try my best. 🙂
hi Ben
All messed buddy. I ma using ignite and I did not check U gave me a link of Track theme. Now I activated it and lost my changes in parent theme.
But its ok.
Hi #Ben
codes you provided earlier worked for me and now problem is solved. Now I just want to manage font size. which code I need to look into ?
I want to remove reply link on individual comments. Is it possible with CSS? I tried this but did not work.
.comment-link {
display: none;
}Oh I’m so sorry about that! Don’t know what I was thinking. So you’ve been able to make the comments updates properly?
You can remove the reply link with the following CSS:
.comment-reply-link { display: none; }For the font size, which text do you want to change the size of (ex. titles, post content)?
some of your codes and some tutorial php . i succeeded. is ignite child theme is not available ?
I want to change font size for “be first to comment” and LEAVE A REPLY text, both are above comment box.
can I add some codes or CSS to prevent content from copy and print ?
Sure, here’s a child theme for Ignite with the previous changes added.
You’ll see in the
style.cssfile the code you need to modify the LEAVE A REPLY text. Right now, it’s just set to the default 26px.can I add some codes or CSS to prevent content from copy and print ?
I’m sorry I don’t quite understand. You don’t want people to be able to copy your content?
The topic ‘Changes in comment form’ is closed to new replies.

(@sam01389)
11 years, 8 months ago
Hey Ben
please help me out
1. Can you tell me how to change that text “You must be logged in to post a comment”? when I am clicking on it for registration it is redirecting me to wordpress registration page but I am using buddypress to register. I want it must redirect to buddypress registration page.
http://bmania.in/wp/uncategorized/this-is-a-test-post/
2. Tell me how I can remove “enter a comment…” from text area field box.
3. how I can change post a comment button ?
Thanks in advance