ThemeShaper Forums » Thematic

[closed]

Customize 'Leave a Comment' Text

(2 posts)
  • Started 2 years ago by violetabella
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. violetabella
    Member

    How can I change the 'Leave a Comment' wording for a child theme? Thanks!

    Posted 2 years ago #
  2. depends on whether you mean the "Post a Comment" or "Post a Reply to" text, but the process is the same... and is the same for anything you care to filter ever. and you can filter anything, anywhere that has an apply_filters. (note the name of the filter is specified in the apply_filters statement and IS NOT necessarily the name of the function. this messed me up for a while.

    the original functions seen in content-extensions.php:

    // 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 );
    }
    
    // Located in comments.php
    // Creates the standard text 'Post a Reply to %s'
    function thematic_postreply_text() {
        $content = __('Post a Reply to %s', 'thematic');
        return apply_filters( 'thematic_postreply_text', $content );
    }

    the child filters that go in your child's functions.php

    function child_postcomment_text() {
        return __('Post some Bacon', 'thematic');
    }
    add_filter('thematic_postcomment_text','child_postcomment_text');
    
    function child_postreply_text() {
        return __('Post Bacon about %s', 'thematic');
    }
    add_filter('thematic_postreply_text','child_postreply_text);

    when you add a filter you take a variable in, mash it up how you like and then return it in place of the original. though in this case we only care to send a unique value back and not a manipulated version of the original... so we don't need to bother w/ claiming in the inputed $content... usually gotten by opening the function this way

    function child_postreply_text($content) {

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.