Question

I am currently using a Hesita Child Theme. I want to edit the copyright text in the footer.

I have found the text I need to edit in 'hestia/inc/views/main/class-hestia-footer.php'

I think know what code to edit, however, I do not know how to make that change in the child theme. I have changed it before, but it has been reverted back to the original after a parent update.

Can anyone help?

Cheers

Was it helpful?

Solution

You Could Also Try This Cheeky Little Trick :)

If you just want a quick and easy, no fuss change, you can do this to the Hestia theme copyright area.

Just add the following code to your child theme CSS or to the WordPress Customise > CSS area.

.copyright a {
    display: none;
}
.copyright:before {
    content: "My site";
}
.copyright:after {
    content: " Craig";
}

Alternatively, you could just hide it all.

.copyright {
    display: none;
}

enter image description here

OTHER TIPS

The default Footer content of the parent theme Hestia is included via Hook hestia_do_bottom_footer_content. So you can remove them via remove_action. and add your own content, own function in your child theme.

Source in the parent theme to valid this hook, file hestia\inc\views\main\class-hestia-footer.php:

/**
 * Initialization of the feature.
 */
public function init() {
    add_action( 'hestia_do_footer', array( $this, 'the_footer_content' ) );
    add_filter( 'wp_nav_menu_args', array( $this, 'modify_footer_menu_classes' ) );
    add_action( 'hestia_do_bottom_footer_content', array( $this, 'bottom_footer_content' ) );
}

The content is inside this method:

/**
 * Function to display footer copyright and footer menu.
 * Also used as callback for selective refresh.
 */
public function bottom_footer_content() {
    $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: %1$s is URL, %2$s is WordPress */
            sprintf(
                '<a href="%1$s" rel="nofollow">%2$s</a>',
                esc_url( __( 'http://wordpress.org', 'hestia' ) ),
                esc_html__( 'WordPress', 'hestia' )
            )
        )
    );

    wp_nav_menu(
        array(
            'theme_location' => 'footer',
            'depth'          => 1,
            'container'      => 'ul',
            'menu_class'     => 'footer-menu',
        )
    );
    ?>
    <?php if ( ! empty( $hestia_general_credits ) || is_customize_preview() ) : ?>
        <div class="copyright <?php echo esc_attr( $this->add_footer_copyright_alignment_class() ); ?>">
            <?php echo wp_kses_post( $hestia_general_credits ); ?>
        </div>
        <?php
    endif;
}

If you are interested in editing the copyright and not removing it I would recommend using the theme_mod filter. Just play with the $new_credits variable in the example below which works in the child functions.php file.

function wp739534_change_hestia_copyright( $old_credits ){

    $new_credits = sprintf(
    /* translators: %1$s is Theme Name, %2$s is WordPress */
        esc_html__( '%1$s | Powered by %2$s', 'hestia-pro' ),
        sprintf(
        /* translators: %s is Theme name */
            '<a href="https://themeisle.com/themes/hestia/" target="_blank" rel="nofollow">%s</a>',
            esc_html__( 'Hestia', 'hestia-pro' )
        ),
        /* translators: %1$s is URL, %2$s is WordPress */
        sprintf(
            '<a href="%1$s" rel="nofollow">%2$s</a>',
            esc_url( __( 'http://wordpress.org', 'hestia-pro' ) ),
            esc_html__( 'WordPress', 'hestia-pro' )
        )
    );

    return $new_credits;
}
add_filter( 'theme_mod_hestia_general_credits', 'wp739534_change_hestia_copyright' );

In the child-theme, you must duplicate a file class-hestia-footer.php like as parent-theme and edit file in child-theme.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top