Hi there,
You can find that code in inc/template-tags.php. You’ll be looking for the editor_posted_on function.
Glad you’re enjoying Editor!
Hello. I have the same question as alitscha above. However, I can’t seem to get the changes to work. I would like to add “Posted on” in from of the date but can’t seem to get it to work. I’ve tried editing the following code by adding “Posted on” in front of the line beginning with printf( __( :
function editor_posted_on() {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<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() )
);
printf( __( 'Posted on <span class="posted-on">%1$s</span><span class="byline"> by </span> %2$s', 'editor' ),
sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
esc_url( get_permalink() ),
$time_string
),
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
)
);
}
endif;
What am I missing here?
Thanks in advance!
Hi there,
Instead of putting that text before the span, place it inside of it, like this:
<span class="posted-on">Posted on %1$s</span>
That should do the trick!
Perfect. Thanks for the reply. That got it on the prent theme, but not on my child theme.
For making these changes permanent in a child theme, do I create the templates-tags file inside an “inc” folder in my child theme? Or can I just add the file to my root child theme folder?
Thanks again!
Hi,
You can copy the editor_posted_on function in whole over to your child theme’s functions.php file. If the function gets defined in your child theme first, it overrides the one in the parent theme. No need to recreate the /inc/template-tags.php thing.