Jump to content

Archived

This topic is now archived and is closed to further replies.

Deveraux

Change Default Comments Text

Recommended Posts

Deveraux

I'm struggling. All I would like to do is change the default comments text from 'Leave a Reply' to 'Leave a Comment' and 'name' says to 'name' said...

 

I would normally do that within a templates comments.php file. I'm happy to hack a DMS file (if I knew which it was) but obviously would prefer a less dramatic approach.

 

Can anyone help please?

Share this post


Link to post
Share on other sites
Danny

Hi,

 

To do this you're going to need to use a child theme, then add the following code to your child themes functions.php file:

 

add_filter('comment_form_defaults','change_comment_text');
  function change_comment_text ($arg) {
    $arg['title_reply'] = __('Submit Your Comment');
    return $arg;
}

 

In regards to the X says to X said, use this:

 

add_filter('gettext', array('Comment_Says_Custom_Text_Wrangler', 'comment_says_text'), 10, 4);
  class Comment_Says_Custom_Text_Wrangler {
    function comment_says_text($translation, $text, $domain) {
      $new_says = 'said'; //whatever you want to have instead of 'says' in comments
      $translations = &get_translations_for_domain( $domain );
      if ( $text == '<cite class="fn">%s</cite> <span class="says">says:</span>' ) {
      if($new_says) $new_says = ' '.$new_says; //compensate for the space character
    return $translations->translate( '<cite class="fn">%s</cite><span class="says">'.$new_says.':</span>' );
     } else {
    return $translation; // standard text
    }
  }
}

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Deveraux

Hi Danny,

 

OK, thanks. I'll give that a go :)

Share this post


Link to post
Share on other sites
Danny

No problem.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • werdnags
      By werdnags+
      I know this does not have anything to do with Pagelines directly but this is happening on my PL5 site.  At the bottom of my blog posts I have put the Facebook Comments Plugin and it works well but when people are leaving comments they are the same for every post.  Does anyone have any idea on how to solve this so the comments are for the post they are on.  Does that make sense? Ha!
      Thanks for any ideas folks.
    • MissT
      By MissT+
      Does the magazine section not support comments?  I have comments allowed but they aren't showing on post pages and there doesn't seem to be a way to add a comments section in either.
      Many thanks in advance.
    • photomom86
      By photomom86+
      I have installed and activated the disqus comments plugin and no matter what I do the comments will not show up on my posts. Is this a know glitch with disqus and pagelines?
    • Jason J
      By Jason J
      Hello all,
      I realize there's a chance that this super-basic question is going to make me look foolish, but I can't find a setting for it.
      Most blogs I come around allow people to reply to a specific comment (there's a reply link for each comment as opposed to just one reply at the bottom of the comment list).
      On a blog I manage that's using Pagelines (and foolishly not a child theme), there's no such reply link for each comment, only one at the bottom of the page.  I thought maybe there was a comments setting somewhere that would enable "in-line" commenting, but I couldn't find one.
      Am I overlooking something very basic, or is it a matter of adjusting the theme code to allow this?
      Thanks in advance,
      -jason
    • rrosewarne
      By rrosewarne
      Hi
      The comments on blog posts isn't working? it used to but now if you click the 'leave comment' link it goes to the bottom of the page and there is no comment box
      http://www.rosewarnegardens.com/the-joys-of-a-qualified-horticulturalist/
×