Changing meta post

Hello,

Is it possible to rearrange my post meta data.

  1. I want to change the meta-post texts, like: posted on, posted in and comments
  2. If it is possible, I want to add content-view-count meta post

Thank you

Dear Arina,

Thank you for asking.

Yes, it is possible. It can be done by overriding the sydney_posted_on() in your child theme. Download the Sydney child theme here. Then copy the following function into the child theme’s functions.php.


function sydney_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%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() )
	);

	$posted_on = sprintf(
		_x( 'Posted on %s', 'post date', 'sydney' ),
		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
	);

	$byline = sprintf(
		_x( '%s', 'post author', 'sydney' ),
		'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
	);

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

	$categories_list = get_the_category_list( __( ', ', 'sydney' ) );
	if ( $categories_list && sydney_categorized_blog() ) {
		printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'sydney' ) . '</span>', $categories_list );
	}
}
endif;

Now you can modify the output of the post meta as you want.

Regards,
Kharis

Thank you for your reply,

I have 0 knowledge of coding things. And I’d tried to modify child theme, but i can’t figure it out.

Is there any way to modify this issue with custom css plugin?

Thank you for your support

Hello there,

> I have 0 knowledge of coding things. And I’d tried to modify child theme, but i can’t figure it out.

Please follow the following links. They will teach you how to child theming:

> Is there any way to modify this issue with custom css plugin?

I am afraid they aren’t about styling territories. Nothing we can do with CSS to achieve those objectives. You will work with PHP.

Regards,
Kharis

Thank you Kharis,

Can you check the code, which you sent above. It seems it doesn’t work, when i copy and paste it in child theme functions.php, then my web site and admin area doesn’t show up. And I need to restore my files.

thank you

Dear Arina,

Apologies for the bug I made. Please remove the last line that says endif;.

Let me know how it goes.

Regards,
Kharis

Hello again,

Thank you very much for your professional support.

I copied it, it works. sorry for this stupid question. Where do I need modify the meta posts? Should I modify it on this code?

> Should I modify it on this code?

Yes, you should.

Regards,
Kharis