Site logo

Archived topic

Entry meta issue, cant display correctly on new site

5 replies · Started by Carlo on October 6, 2020

Viewing posts 1–6 of 6

Hi,
i have a previous site that with the help from here i was able to modify the entry meta data to customize exactly how i wanted it.

I have a new site that im trying to do exactly the same, but i cannot work out why it's not working...
I have used the same snippet and CSS, from my "working" site, but something is wrong and i just cant "see" what it is.

I'm trying to replicate the following, straight after the H1 Title:
(Author Image) Author name | Published/Last Updated (Date) | Reading Time (minutes)

this is what i have added so far:

added the below as a snippet

add_filter( 'generate_post_author', '__return_false' );
add_filter( 'generate_show_comments', '__return_false' );

add_filter( 'generate_post_date_output', function( $date, $time_string ) {
    printf( ' <span class="byline">%1$s</span>',
        sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>',
            esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
            esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
            esc_html( get_the_author() ),
            get_avatar( get_the_author_meta( 'ID' ) )
        )
    );

    if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
        echo '<span class="comments-link">';
            comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
        echo '</span>';
    }

    printf( '<span class="posted-on">%s</span>',
        $time_string
    );
	echo do_shortcode( '[editorskit display="wordcount" before="Reading Time: " after=" min"]' );
}, 10, 2 );

added the below in simple CSS:

/*style gravatar author image and date in posts*/
.byline img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    position: relative;
    vertical-align: middle;
    margin: 0 10px 0 0;
}

.byline,
.comments-link,
.posted-on {
	display: inline-block;
}

.comments-link,
.posted-on {
	border-left: 1px solid #ddd;
	padding-left: 10px;
	margin-left: 10px;
}

.comments-link:before {
	display: none;
}

h1.entry-title {
    margin-bottom: 10px;
}

.editorskit-shortcode {
	display: inline-block;
	border-left: 1px solid #ddd;
	padding-left: 10px;
	margin-left: 10px;
}
@media (max-width: 768px) {
    .entry-meta, .posted-on,
    .editorskit-shortcode {
        font-size: 16px;
        display: block;
        border-left: 0;
        padding-left: 0;
        margin-left: 0;
    }
}

/*Show Updated Post Date*/
.posted-on .updated {
    display: inline-block;
}

.posted-on .updated + .entry-date {
    display: none;
}
.posted-on .updated:before {
    content: "Last Updated ";
}
.posted-on .entry-date:before {
    content: "Published ";
}

Hi there,

the post meta is being hidden with CSS - can you disable Autoptimize so i can see where thats coming from?

sure, i just deactivated Autoptimize.

thankyou, that was exactly the issue.

No problem :)

This archived topic is closed to new replies.