Site logo

Archived topic

Gravatar and comments to post meta

7 replies · Started by Sumit on March 2, 2019

Viewing posts 1–8 of 8

I added those code in the custom CSS field but it was showing error.

Please tell me where to add those code.

Waiting for your reply.

I've added the PHP code but size of gravator is to big and it's in the square shape.

I want the author gravatar size and shape (i.e. round shape) same as https://masterblogging.com/blog/

I also want to add separator "|" between name, no. of comments and last updated date. (same as above blog)

I have added this code in my site:

add_filter( 'generate_post_author', '__return_false' );
add_filter( 'generate_show_comments', '__return_false' );
add_filter( 'generate_post_date_output', 'tu_fancy_byline' );
function tu_fancy_byline( $date ) {
	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>';
	}

	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
	
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
	}
	
	$time_string = sprintf( $time_string,
		esc_attr( get_the_date( 'c' ) ),
		esc_html( get_the_date() ),
		esc_attr( get_the_modified_date( 'c' ) ),
		esc_html( get_the_modified_date() )
	);

	return sprintf( '<span class="posted-on">%s</span>', // WPCS: XSS ok, sanitization ok.
		$time_string
	);
}

please give me a modified code.

I'm waiting...

Thanks a lot Tom.

I'm facing these two problems.

1) In the right sidebar of my blog (https://blogginglift.com/blog/), the 1st widget background colour is orange. (all the time)
How to fix this problem.

2) I'm using post excerpt option in GeneratPress theme. and with this option, I want to show a full-width featured image thumbnail in my blog section. How to do it?

Thanks in advance.

Please open a new topic(s) for the separate questions.

Thanks!

This archived topic is closed to new replies.