-1

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

0

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

  • Possible, but it will load (performance) and also will read via bots, search engines etc. – bueltge Sep 3 '18 at 13:11
1

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;
}
0

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' );
-1

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

  • I have tried that, however, it does not work :( – Craig Aug 31 '18 at 10:22
  • Depends on how the file is loaded. The method only works for system files (home.php, single.php, ..). It's very unlikely to work for /inc/views/main/class-hestia-footer.php – kero Aug 31 '18 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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