1

Below is the file where the information is pulled from.

I have tried adding the /inc folder to the child theme and adding the template-tags.php with the changed but this does not make any affect.

/wp-content/themes/hestia/inc/template-tags.php

This is the original code here…

function hesta_bottom_footer_content( $is_callback = false ) {
    if ( ! $is_callback ) {
    ?>
        <div class="hestia-bottom-footer-content">
        <?php
    }
    $hestia_general_credits     = get_theme_mod(
        'hestia_general_credits',
        sprintf(
            /* translators: %1$s is Theme Name, %2$s is WordPress */
            esc_html__( '%1$s | Powered by %2$s', 'hestia' ),
            sprintf(
                /* translators: %s is Theme name */
                '<a href="https://themeisle.com/themes/hestia/" target="_blank"         rel="nofollow">%s</a>',
                esc_html__( 'Hestia', 'hestia' )
            ),
            /* translators: %s is WordPress */
            sprintf(
                '<a href="%1$s" rel="nofollow">%2$s</a>',
                esc_url( __( 'http://wordpress.org', 'hestia' ) ),
                esc_html__( 'WordPress', 'hestia' )
            )
        )
    );
    $hestia_copyright_alignment = get_theme_mod( 'hestia_copyright_alignment',    'right' );
    $menu_class                 = 'pull-left';
    $copyright_class            = 'pull-right';
    switch ( $hestia_copyright_alignment ) {
        case 'left':
            $menu_class      = 'pull-right';
            $copyright_class = 'pull-left';
            break;
        case 'center':
            $menu_class      = 'hestia-center';
            $copyright_class = 'hestia-center';
    }
    wp_nav_menu(
        array(
            'theme_location' => 'footer',
            'depth'          => 1,
            'container'      => 'ul',
            'menu_class'     => 'footer-menu ' . esc_attr( $menu_class ),
        )
    );
        ?>
    <?php if ( ! empty( $hestia_general_credits ) || is_customize_preview() ) :    ?>
        <div class="copyright <?php echo esc_attr( $copyright_class ); ?>">
            <?php echo wp_kses_post( $hestia_general_credits ); ?>
        </div>
    <?php endif; ?>
    <?php
    if ( ! $is_callback ) {
    ?>
        </div>
        <?php
    }
   }

And this is the same code with the changes i want to make which is the “designed by” part

function hesta_bottom_footer_content( $is_callback = false ) {
    if ( ! $is_callback ) {
    ?>
        <div class="hestia-bottom-footer-content">
        <?php
    }
    $hestia_general_credits     = get_theme_mod(
        'hestia_general_credits',
        sprintf(
            /* translators: %1$s is Theme Name, %2$s is WordPress */
            esc_html__( 'Designed by HCL Design' ),
            sprintf(
                /* translators: %s is Theme name */
                '<a href="https://themeisle.com/themes/hestia/" target="_blank" rel="nofollow">%s</a>',
                esc_html__( 'Hestia', 'hestia' )
            ),
            /* translators: %s is WordPress */
            sprintf(
                '<a href="%1$s" rel="nofollow">%2$s</a>',
                esc_url( __( 'http://wordpress.org', 'hestia' ) ),
                esc_html__( 'WordPress', 'hestia' )
            )
        )
    );
    $hestia_copyright_alignment = get_theme_mod( 'hestia_copyright_alignment', 'right' );
    $menu_class                 = 'pull-left';
    $copyright_class            = 'pull-right';
    switch ( $hestia_copyright_alignment ) {
        case 'left':
            $menu_class      = 'pull-right';
            $copyright_class = 'pull-left';
            break;
        case 'center':
            $menu_class      = 'hestia-center';
            $copyright_class = 'hestia-center';
    }
    wp_nav_menu(
        array(
            'theme_location' => 'footer',
            'depth'          => 1,
            'container'      => 'ul',
            'menu_class'     => 'footer-menu ' . esc_attr( $menu_class ),
        )
    );
        ?>
    <?php if ( ! empty( $hestia_general_credits ) || is_customize_preview() ) : ?>
        <div class="copyright <?php echo esc_attr( $copyright_class ); ?>">
            <?php echo wp_kses_post( $hestia_general_credits ); ?>
        </div>
    <?php endif; ?>
    <?php
    if ( ! $is_callback ) {
    ?>
        </div>
        <?php
    }
}

So is there anyway to make this change by adding some sort of function to the functions.php or any other file? Any solution will do that allows me to make this change and it not to change every time the theme updates.

In the footer.php there is just

<?php do_action( 'hestia_do_footer' ); ?>

which is what led me to find the source of this do_action.

Any help will be appreciated and please let me know any other details you need as this is very hard to explain.

2
  • 3
    Looking at that code, there should be a setting in the Customiser for changing the text you want to change, without template changes. Commented Aug 31, 2017 at 14:03
  • In the pro version there is this option. But i am looking at doing this with the free version which the theme developers have said is fine
    – Harvey
    Commented Sep 1, 2017 at 7:41

1 Answer 1

1

You need to modify 2 functions not only 1 in your functions.php:

/**
 * Function to display footer content.
 *
 * @since 1.1.24
 * @access public
 */
//ADDED CHILD TO THE END OF THE NAME
function hestia_the_footer_content_child() {
    /**
     * Array holding all registered footer widgets areas
     */
    $hestia_footer_widgets_ids = array( 'footer-one-widgets', 'footer-two-widgets', 'footer-three-widgets' );
    $hestia_footer_class = 'col-md-4';
    $footer_has_widgets = false;
    $hestia_nr_footer_widgets = get_theme_mod( 'hestia_nr_footer_widgets','3' );

    /**
     *  Enabling alternative footer style
     */
    $footer_style = '';
    $footer_style = get_theme_mod( 'hestia_alternative_footer_style', 0 );
    if ( isset( $footer_style ) && $footer_style == 0 ) {
        $footer_style = 'footer-black';
    } else {
        $footer_style = '';
    }

    /**
     *  Get the widgets areas ids and class corresponding to the number selected by the user
     */
    if ( ! empty( $hestia_nr_footer_widgets ) ) {
        $hestia_footer_widgets_ids = array_slice( $hestia_footer_widgets_ids, 0, $hestia_nr_footer_widgets );
        switch ( $hestia_nr_footer_widgets ) {
            case 1:
                $hestia_footer_class = 'col-md-12';
                break;
            case 2:
                $hestia_footer_class = 'col-md-6';
                break;
            case 3:
                $hestia_footer_class = 'col-md-4';
                break;
            case 4:
                $hestia_footer_class = 'col-md-3';
                break;
        }
    }
    /**
     * Check if the selected footer widgets areas are not empty
     */
    if ( ! empty( $hestia_footer_widgets_ids ) ) {
        foreach ( $hestia_footer_widgets_ids as $hestia_footer_widget_item ) {
            $footer_has_widgets = is_active_sidebar( $hestia_footer_widget_item );
            if ( $footer_has_widgets ) {
                break;
            }
        }
    }

    hestia_before_footer_trigger();
    ?>
    <footer class="footer <?php echo esc_attr( $footer_style ); ?> footer-big">
        <?php hestia_before_footer_content_trigger(); ?>
        <div class="container">
            <?php
            if ( $footer_has_widgets ) {
            ?>
                <div class="content">
                    <div class="row">
                        <?php
                        if ( ! empty( $hestia_footer_widgets_ids ) ) {
                            foreach ( $hestia_footer_widgets_ids as $hestia_footer_widget_item ) {
                                if ( is_active_sidebar( $hestia_footer_widget_item ) ) {
                                    echo '<div class="' . $hestia_footer_class . '">';
                                        dynamic_sidebar( $hestia_footer_widget_item );
                                    echo '</div>';
                                }
                            }
                        }
                        ?>
                    </div>
                </div>
                <hr/>
                <?php
            }
            ?>
            <?php hestia_before_footer_widgets_trigger(); ?>
            <div class="hestia-bottom-footer-content">
                <?php
//ADDED CHILD THIS IS THE CALL TO THE COPYRIGHT
                hesta_bottom_footer_content_child();
                ?>
            </div>
            <?php hestia_after_footer_widgets_trigger(); ?>
        </div>
        <?php hestia_after_footer_content_trigger(); ?>
    </footer>
    <?php
    hestia_after_footer_trigger();
}
//WE CHANGE THE ACTION NAME AND THE CALL IS TO OUR FUNCTION NOW
add_action( 'hestia_do_footer_child', 'hestia_the_footer_content_child' );

    //THIS IS YOUR MODIFIED FUNCTION
    function hesta_bottom_footer_content_child( $is_callback = false ) {
    if ( ! $is_callback ) {
    ?>
        <div class="hestia-bottom-footer-content">
        <?php
    }
    $hestia_general_credits     = get_theme_mod(
        'hestia_general_credits',
        sprintf(
            /* translators: %1$s is Theme Name, %2$s is WordPress */
            esc_html__( 'Designed by HCL Design' ),
            sprintf(
                /* translators: %s is Theme name */
                '<a href="https://themeisle.com/themes/hestia/" target="_blank" rel="nofollow">%s</a>',
                esc_html__( 'Hestia', 'hestia' )
            ),
            /* translators: %s is WordPress */
            sprintf(
                '<a href="%1$s" rel="nofollow">%2$s</a>',
                esc_url( __( 'http://wordpress.org', 'hestia' ) ),
                esc_html__( 'WordPress', 'hestia' )
            )
        )
    );
    $hestia_copyright_alignment = get_theme_mod( 'hestia_copyright_alignment', 'right' );
    $menu_class                 = 'pull-left';
    $copyright_class            = 'pull-right';
    switch ( $hestia_copyright_alignment ) {
        case 'left':
            $menu_class      = 'pull-right';
            $copyright_class = 'pull-left';
            break;
        case 'center':
            $menu_class      = 'hestia-center';
            $copyright_class = 'hestia-center';
    }
    wp_nav_menu(
        array(
            'theme_location' => 'footer',
            'depth'          => 1,
            'container'      => 'ul',
            'menu_class'     => 'footer-menu ' . esc_attr( $menu_class ),
        )
    );
        ?>
    <?php if ( ! empty( $hestia_general_credits ) || is_customize_preview() ) : ?>
        <div class="copyright <?php echo esc_attr( $copyright_class ); ?>">
            <?php echo wp_kses_post( $hestia_general_credits ); ?>
        </div>
    <?php endif; ?>
    <?php
    if ( ! $is_callback ) {
    ?>
        </div>
        <?php
    }
}

Now in footer.php we call our action:

<?php do_action( 'hestia_do_footer_child' ); ?>

Even if you modified the function, the actual function of the copyright was being called by another function, so you need to make your own version of that one too so it calls your modified function.

13
  • Hi, Do you want me to upload the PHP files so you can have a look. I get what you are saying but the function that sets the copyright info is within the parent theme/inc which if i copy to the child theme/inc it does not override the parent files. I'm not too familiar with PHP I'm afraid. So Where do i add the function mentioned in my first post?
    – Harvey
    Commented Sep 1, 2017 at 7:48
  • Hi, it doesnt mattter if the copyright function its in the parent, just dont call it, yeah if you upload the PHP files would help.
    – David Lee
    Commented Sep 1, 2017 at 13:15
  • Okay I will upload them now and send the link :)
    – Harvey
    Commented Sep 2, 2017 at 16:54
  • That's a google drive linke with the /hestia/inc/template-tags.php where the copyright info is set. Then there are the /hestia_child/footer.php and hestia_child/functions.php. Let me know if you need any of the other files :)
    – Harvey
    Commented Sep 2, 2017 at 17:06

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