I created a child theme from the TwentySeventeen theme and it seems to work.

I can override the content.php file by creating a matching folder and my own content.php in my child theme.


...Works fine.

However, I tried to do the same thing to override the metta tags in the header of a single post by doing the following


...and the functions in template-tags.php (eg. twentyseventeen_posted_on() ) are -not- overriding the main theme's version as I expected.

What am I doing wrong?

1 Answer 1


If you take a look at template-tags.php file, then you'll see something like that:

if ( ! function_exists( 'twentyseventeen_posted_on' ) ) :
 * Prints HTML with meta information for the current post-date/time and author.
function twentyseventeen_posted_on() {

    // Get the author name; wrap it in a link.
    $byline = sprintf(
        /* translators: %s: post author */
        __( 'by %s', 'twentyseventeen' ),
        '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author() . '</a></span>'

    // Finally, let's write all of this to the page.
    echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>';

The if statement in the first line of that code is responsible for checking if given function is already defined.

So what you can do about it? Just define your own function called twentyseventeen_posted_on in your child theme and your function will be the one that is used.

Important: It's crucial that you define your function before TwentySeventeen defines it's own version.

  • I did as you say. I only removed the IF statement as it seemed unnecessary. How do I make sure -my- child version is loaded before the main theme version?
    – jchwebdev
    Jun 18, 2018 at 22:34
  • 1
    If you add it in functions.php of your child theme, then it should be loaded before parent themes version. Jun 18, 2018 at 22:51
  • I used this to change -"by" author- by "por" in Spanish. Translator package doesn't translate it.
    – dstonek
    Mar 4, 2019 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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