Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking to change the comments form title (my theme defaults this to "Leave a Comment" or "Leave a reply to").

I thought perhaps I could add a hook to comment_form_defaults but my snippet below isn't working... any thoughts?

    <?php 
add_filter('comment_form_defaults', 'askQuestion');

function askQuestion($defaults) {
  $defaults['title_reply'] = 'Ask a Question';
  $defaults['title_reply_to'] = 'Your text %s';
  return $defaults;
}
?>

This is being added to the HTML editor of the page editor within wordpress. We are using the ExecPHP plugin to compile code within posts/pages. We are looking for a way to do this on just this page, not every comment form on our blog.

share|improve this question
    
What theme are you using? –  t31os Aug 6 '11 at 10:43
    
add comment

1 Answer 1

Add the code to your comment template file or your functions.php with a page conditional. The comments file depends on your theme, by default it is comments.php , but it could be named anything, you need to look at your theme's code.

For example if it's the contact page,

  if (is_page('Contact'))
    // do something
share|improve this answer
    
I thought about this, but how can I keep from having to re-add this to comments.php everytime I upgrade wordpress or my theme? –  themerlinproject Aug 6 '11 at 6:13
    
WordPress does not touch theme files when it upgrades, your theme on the other hand depends but typically they do not over-write anything you added, you can safeguard this rather easily but writing a custom functions file like my_comment_function.php and simply include it in functions.php. –  Wyck Aug 6 '11 at 16:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.