parent theme function doesn't affect child theme post output

I have the following parent theme function located in inc/template-tags.php

    if ( ! function_exists( 'twentysixteen_excerpt' ) ) :
    /**
     * Displays the optional excerpt.
     *
     * Wraps the excerpt in a div element.
     *
     * Create your own twentysixteen_excerpt() function to override in a child theme.
     *
     * @since Twenty Sixteen 1.0
     *
     * @param string $class Optional. Class string of the div element. Defaults to 'entry-summary'.
     */
    function twentysixteen_excerpt( $class = 'entry-summary' ) {
        $class = esc_attr( $class );

        if ( has_excerpt() || is_search() ) :
            ?
            div class="?php echo $class; ?"
                ?php the_excerpt(); ?
            /div!-- .?php echo $class; ? --
            ?php
        endif;
    }
endif;

however it doesn't wrap my child theme posts output in divs. I know that if a child theme doesn't have function with same name, parent function should kick in. I am wondering however if my parent function not working because of a different folder structure in my child theme - I don't have inc/template-tags.php

Interestingly enough I was able to override in my child theme the following parent function located in the same file inc/template-tags.php . I placed the below function in my child theme functions.php and changed the wording of "Continue reading" to "Read more" which took effect in the child theme.

So my question is why the first function has no effect on child theme while the second does?

  if ( ! function_exists( 'twentysixteen_excerpt_more' )  ! is_admin() ) :
    /**
     * Replaces "[...]" (appended to automatically generated excerpts) with ... and
     * a 'Continue reading' link.
     *
     * Create your own twentysixteen_excerpt_more() function to override in a child theme.
     *
     * @since Twenty Sixteen 1.0
     *
     * @return string 'Continue reading' link prepended with an ellipsis.
     */
    function twentysixteen_excerpt_more() {
        $link = sprintf(
            'a href="%1$s" class="more-link"%2$s/a',
            esc_url( get_permalink( get_the_ID() ) ),
            /* translators: %s: Post title. */
            sprintf( __( 'Continue readingspan class="screen-reader-text" "%s"/span', 'twentysixteen' ), get_the_title( get_the_ID() ) )
        );
        return ' hellip; ' . $link;
    }
    add_filter( 'excerpt_more', 'twentysixteen_excerpt_more' );
endif;

Topic function-exists Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.