ThemeShaper Forums » Thematic

[closed]

Edit "Post a comment" text

(3 posts)
  • Started 7 years ago by cookieandkate
  • Latest reply from cookieandkate
  • This topic is resolved

Tags:

  1. Hello! I would like to add a nice message after the "post a comment" line that appears above the comment form. I suspect it will require a hook but don't know enough about PHP to write it myself. Has anyone found a solution, or do you have any suggestions for me? Thank you!

    Posted 7 years ago #
  2. if you look in comments-extensions.php you will see:

    // Located in comments.php
    // Creates the standard text 'Post a Comment'
    function thematic_postcomment_text() {
        $content = __('Post a Comment', 'thematic');
        return apply_filters( 'thematic_postcomment_text', $content );
    }

    that apply_filters is your cue that you can filter that text. you filter it exactly the same way you'd filter anything else.

    function postcomment_text(){
       $text = "Dude, have some bacon and post a comment.";
       return $text;
    }
    add_filter('thematic_postcomment_text','postcomment_text');

    or if you wanted to maintain the original and just add on to it you'd need to pass in the variable and then use .= instead of just =

    function postcomment_text($text){
       $text .= " Dude, have some bacon!";
       return $text;
    }
    add_filter('thematic_postcomment_text','postcomment_text');

    which would return "Post a comment. Dude, have some bacon!"

    Posted 7 years ago #
  3. Thank you, Helga! That worked like a charm.

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.