Title: modifying function leaf_comment in child theme
Last modified: August 21, 2016

---

# modifying function leaf_comment in child theme

 *  [webmystery](https://wordpress.org/support/users/webmystery/)
 * (@webmystery)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/modifying-function-leaf_comment-in-child-theme/)
 * I was stuck on this for a while and just figured it out. Maybe this will help
   someone else. From the description in the file includes/template-tags.php ” *
   To override this walker in a child theme without modifying the comments template
   *
   simply create your own leaf_comment(), and that function will be used instead.”
   It looked like I should be able to copy includes/template-tags.php into my child
   theme, modify the leaf_comment function, and change the output of my comments.
 * WRONG! the answer is to copy /create the function(s) you want to modify into 
   your otherwise empty functions.php.
 * I looked at the recommended leaf child theme, which only discusses removing functions
   that aren’t in proper wrappers and does not apply here. I tried all sorts of 
   silliness to get the function file in my child’s includes folder to load – giving
   it a new name so as to not conflict with the parent and so on. In hindsight maybe
   it should have been obvious to just put naked functions in the child’s functions.
   php. I feel stupid already. Yea I read all about child themes, but those instructions
   don’t assume that the parent functions.php is including external files. That 
   threw me.
 * If only that comment had said “…simply create your own leaf_comment() **_in functions.
   php_**, and that function will be used instead.”
 *  I love WordPress, but sometimes the hoops we have to jump through just to change
   a few lines of text …

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [tizz](https://wordpress.org/support/users/tizz/)
 * (@tizz)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/modifying-function-leaf_comment-in-child-theme/#post-4221542)
 * webmystery, when you downloaded leaf child theme the functions.php file was the
   first to watch, you could see that everything is explained.
    As written [here](http://codex.wordpress.org/Theme_Development)
   and [here](http://codex.wordpress.org/Child_Themes), in that file you can read
   that certain functions – those wrapped in a _function\_exists()_ call – (the 
   pluggable ones e.g. as _leaf\_comment_), are overwriteable by defining them in
   your child theme’s functions.php file. The child theme’s functions.php file is
   included before the parent theme’s file, so the child theme functions is used.
   Take a look also to parent’s theme functions.php, I’m not a coder as you aren’t,
   but I think it’s because of that definitions (get_template_directory) that the“
   child theme’s functions thing” works.
 *  Thread Starter [webmystery](https://wordpress.org/support/users/webmystery/)
 * (@webmystery)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/modifying-function-leaf_comment-in-child-theme/#post-4221618)
 * Did I say I feel stupid already? I have to keep reminding myself that if a solution
   to a problem seems overly complicated I’m probably approaching it all wrong.
 * I didn’t find the leaf child theme until I’d already been banging my head for
   a while. It’s functions.php doesn’t say anything about the require statements–
   and yea – I know that those files ultimately end up in functions.php. Like I 
   said – over-complicating doesn’t help.
 * Still – I can’t be the only person who has been flummoxed by this. Most things
   you put in the child theme override the parent – why not the stuff in the includes
   folder (rhetorical question)?
 *  [tizz](https://wordpress.org/support/users/tizz/)
 * (@tizz)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/modifying-function-leaf_comment-in-child-theme/#post-4221622)
 * I’d forget the stupidity, that’s not the point.
    For me, as you, non-coders, 
   it takes some more time to understand things about how code works, it’s normal.
   Maybe at the moment we can almost read the code, but not write it, not yet, that’s
   OK. There are people who never even get there. But, you didn’t read the pages
   I’ve linked to and you didn’t read those themes files, right? The answer to your
   last non-rhetorical question is [here](http://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme)(
   same page linked above). Then, soon after, look at parent’s theme functions.php,
   that’s _require\_once_ that do the trick, I think (not assume). Then, once again,
   look at child’s theme functions.php, because isn’t true that isn’t explained…
   maybe shortly, but it’s explained. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘modifying function leaf_comment in child theme’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/leaf/1.1.2/screenshot.png)
 * Leaf
 * [Support Threads](https://wordpress.org/support/theme/leaf/)
 * [Active Topics](https://wordpress.org/support/theme/leaf/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/leaf/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/leaf/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [tizz](https://wordpress.org/support/users/tizz/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/modifying-function-leaf_comment-in-child-theme/#post-4221622)
 * Status: not resolved