BLACK FRIDAY & CYBER MONDAY SALE! 30% DISCOUNT!! Coupon code:bf30 Enjoy!!!

Change text before author name in byline?

Home Forums ColorNews Free Change text before author name in byline?

This topic contains 3 replies, has 2 voices, and was last updated by  Nitu Shrestha 1 week, 5 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1393003

    melissa.stamm
    Participant

    Hi! I would like to change the text that appears in the byline from “Posted by” (author name) to just “By.” I do have a child theme, so if it requires copying template files to the child theme and modifying something there, can you please point me to the correct file?

    #1393053

    Nitu Shrestha
    Moderator

    @melissa.stamm

    You can edit functions.php file of child theme to change the text ‘Posted by’.

    Thanks.

    #1393109

    melissa.stamm
    Participant

    Thanks! It took me a while to find, but I copied this entire block of code from inc/functions.php to my child theme functions.php file with the text modified as needed. Can you confirm if this is what you meant/the proper way to do it? Or will this cause problems when the parent theme updates?

    function colornews_entry_meta() {
    	if ( 'post' == get_post_type() ) :
    		echo '<div class="below-entry-meta">';
    		?>
    
    		<span class="byline"><span class="author vcard"><i class="fa fa-user"></i><a class="url fn n" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta(ID) ) ); ?>" title="<?php echo get_the_author(); ?>"><?php _e( 'By: ', 'colornews' ); echo esc_html( get_the_author() ); ?></a></span></span>
    
    		<?php
    		if ( ! post_password_required() && comments_open() ) { ?>
    			<span class="comments"><?php comments_popup_link( __( '<i class="fa fa-comment"></i> 0 Comment', 'colornews' ), __( '<i class="fa fa-comment"></i> 1 Comment', 'colornews' ), __( '<i class="fa fa-comments"></i> % Comments', 'colornews' ) ); ?></span>
    		<?php }
    		$tags_list = get_the_tag_list( '<span class="tag-links"><i class="fa fa-tags"></i>', __( ', ', 'colornews' ), '</span>' );
    		if ( $tags_list ) echo $tags_list;
    
    		edit_post_link( __( 'Edit', 'colornews' ), '<span class="edit-link"><i class="fa fa-edit"></i>', '</span>' );
    
    		echo '</div>';
    	endif;
    }
    #1393180

    Nitu Shrestha
    Moderator

    @melissa.stamm

    That is the proper way and it will not cause any problem when parent theme updates.

    Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.