• Resolved jeja7

    (@jeja7)


    Hey!

    Since I’m still learning, I would just like to check if I did this correctly…not to mess up the code.

    So, I wanted to add a class to the „post-header-title“, which is in template-tags.php file.
    I copied to Bento child functions.php the entire code from the parent template-tags.php, starting with:

    // Display post header
    if ( ! function_exists( ‘bento_post_header’ ) ) {
    ……

    and added desired class there ( <div class=”post-header-title animated pulse”> ).

    It worked.
    Is it the optimal, best way to customize stuff from template-tags.php?
    Or there is a better way to do it?

    Thanks a lot!

    P.S. Sorry… I’m aware that this kind of question is general one, not exclusively related to Bento theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author satoristudio

    (@satoristudio)

    Hey jeja7,

    all functions in Bento’s template-tags.php file are designed to be pluggable – i.e. they can be easily overridden by the child theme functions of the same name. Since the parent theme’s functions are already using if-conditionals when they are declared, you don’t need to use those in the child theme; your child theme’s function can thus look like this:

    function bento_post_header() {
       // function here
    }

    Sincerely,
    Andrii / Satori Studio

    Thread Starter jeja7

    (@jeja7)

    Got it. Thanks!

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

The topic ‘Customizing code from template-tags.php in child theme’ is closed to new replies.