How to change post meta data in Hestia

How to change the subtitle text/information in Hestia?

1. First and most important, make sure you are using a child theme. Follow this doc to create a child theme for Hestia.

2. In your child theme's  functions.php file, add one of the next pieces of code according to your preferences:

On Single Post Page

A. Default behaviour

add_filter( 'hestia_single_post_meta','child_hestia_single_post_meta_function' );

function child_hestia_single_post_meta_function() {
    return sprintf(
        /* translators: %1$s is Author name wrapped, %2$s is Date*/
        esc_html__( 'Published by %1$s on %2$s', 'hestia-pro' ),
        /* translators: %1$s is Author name, %2$s is Author link*/
        sprintf(
            '<a href="%2$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
            esc_html( get_the_author_meta( 'display_name', get_post_field ('post_author') ) ),
            esc_url( get_author_posts_url( get_post_field ('post_author') ) )
        ),
        /* translators: %s is Date */
        sprintf(
            '<time class="date updated published" datetime="%2$s">%1$s</time>',
            esc_html( get_the_time( get_option( 'date_format' ) ) ), esc_html( get_the_date( DATE_W3C ) )
        )
    );
}


B. Change publish date with last updated date

add_filter( 'hestia_single_post_meta','child_hestia_single_post_meta_function' );

function child_hestia_single_post_meta_function() {
    return sprintf(
        /* translators: %1$s is Author name wrapped, %2$s is Date*/
        esc_html__( 'Published by %1$s updated on %2$s', 'hestia-pro' ),
        /* translators: %1$s is Author name, %2$s is Author link*/
        sprintf(
            '<a href="%2$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
             esc_html( get_the_author_meta( 'display_name', get_post_field ('post_author') ) ),
             esc_url( get_author_posts_url( get_post_field ('post_author') ) )
        ),
        /* translators: %s is Date */
        sprintf(
            '<time class="date updated published" datetime="%2$s">%1$s</time>',
            esc_html( get_the_modified_time( get_option( 'date_format' ) ) ), esc_html( get_the_modified_date( DATE_W3C ) )
        )
    );
}


C. Have both publish date and last updated date

add_filter( 'hestia_single_post_meta','child_hestia_single_post_meta_function' );

 function child_hestia_single_post_meta_function() {
     return sprintf(
         /* translators: %1$s is Author name wrapped, %2$s is Date*/
         esc_html__( 'Published by %1$s on %2$s updated on %3$s', 'hestia-pro' ),
         /* translators: %1$s is Author name, %2$s is Author link*/
         sprintf(
             '<a href="%2$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
             esc_html( get_the_author_meta( 'display_name', get_post_field ('post_author') ) ),
             esc_url( get_author_posts_url( get_post_field ('post_author') ) )
         ),
         /* translators: %s is Date */
         sprintf(
             '<time class="date updated published" datetime="%2$s">%1$s</time>',
             esc_html( get_the_time( get_option( 'date_format' ) ) ), esc_html( get_the_date( DATE_W3C ) )
         ),
         /* translators: %s is Date */
         sprintf(
             '<time class="date updated published" datetime="%2$s">%1$s</time>',
             esc_html( get_the_modified_time( get_option( 'date_format' ) ) ), esc_html( get_the_modified_date( DATE_W3C ) )
         )
     );
 }

On The Blog Page

A. Default behaviour

add_filter( 'hestia_blog_post_meta','child_hestia_blog_post_meta_function' );

function child_hestia_blog_post_meta_function() {
    return sprintf(
        /* translators: %1$s is Author name wrapped, %2$s is Time */
        esc_html__( 'By %1$s, %2$s', 'hestia-pro' ),
        /* translators: %1$s is Author name, %2$s is author link */
        sprintf(
            '<a href="%2$s" title="%1$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
            esc_html( get_the_author() ),
            esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
        ),
        sprintf(
        /* translators: %1$s is Time since post, %2$s is author Close tag */
            esc_html__( '%1$s ago %2$s', 'hestia-pro' ),
            sprintf(
            /* translators: %1$s is Time since, %2$s is Link to post */
                '<a href="%2$s"><time>%1$s</time>',
                esc_html( human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) ),
                esc_url( get_permalink() )
            ),
            '</a>'
        )
    );
}


B. Change publish date with last updated date

add_filter( 'hestia_blog_post_meta','child_hestia_blog_post_meta_function' );

function child_hestia_blog_post_meta_function() {
    return sprintf(
        /* translators: %1$s is Author name wrapped, %2$s is Time */
        esc_html__( 'By %1$s, %2$s', 'hestia-pro' ),
        /* translators: %1$s is Author name, %2$s is author link */
        sprintf(
            '<a href="%2$s" title="%1$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
            esc_html( get_the_author() ),
            esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
        ),
        sprintf(
        /* translators: %1$s is Time since post, %2$s is author Close tag */
            esc_html__( '%1$s ago %2$s', 'hestia-pro' ),
            sprintf(
            /* translators: %1$s is Time since, %2$s is Link to post */
                '<a href="%2$s"><time>%1$s</time>',
                esc_html( human_time_diff( get_the_modified_time( 'U' ), current_time( 'timestamp' ) ) ),
                esc_url( get_permalink() )
            ),
            '</a>'
        )
    );
}

This code can be adapted to match pretty much everything you may need. You can remove the author name, add another text, format the date, etc.

C. Change publish date format

add_filter( 'hestia_blog_post_meta','child_hestia_blog_post_meta_function' );

function child_hestia_blog_post_meta_function() {
    return sprintf(
        /* translators: %1$s is Author name wrapped, %2$s is Time */
        esc_html__( 'By %1$s, %2$s', 'hestia-pro' ),
        /* translators: %1$s is Author name, %2$s is author link */
        sprintf(
            '<a href="%2$s" title="%1$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
            esc_html( get_the_author() ),
            esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
        ),
        sprintf(
        /* translators: %1$s is Time since post, %2$s is author Close tag */
            esc_html__( '%1$s %2$s', 'hestia-pro' ),
            sprintf(
            /* translators: %1$s is Time since, %2$s is Link to post */
                '<a href="%2$s"><time>%1$s</time>',
                 get_the_date('F j, Y'),
                esc_url( get_permalink() )
            ),
            '</a>'
        )
    );
}

D. Change publish date format & remove the author

add_filter( 'hestia_blog_post_meta','child_hestia_blog_post_meta_function' );

function child_hestia_blog_post_meta_function() {
    return sprintf(
        /* translators: %1$s is Time since post */
            esc_html__( '%1$s', 'hestia-pro' ),
            sprintf(
            /* translators: %1$s is Time since, %2$s is Link to post */
                '<a href="%2$s"><time>%1$s</time>',
                 get_the_date('F j, Y'),
                esc_url( get_permalink() )
            )
        
    );
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us