Viewing 8 replies - 1 through 8 (of 8 total)
  • Theme Author Veda

    (@vedathemes)

    Hello @ebrark
    Sorry for late reply.

    Copy and paste following code at the end of your child theme’s functions.php file (If you do not use child theme, please use Code Snippet plugin).

    function bayleaf_custom_entry_meta_fn() {
    	return [ 'bayleaf_custom_entry_meta' ];
    }
    function bayleaf_custom_entry_meta() {
    	printf( '<span class="meta-sep">%s</span>', esc_html__( 'by', 'bayleaf' ) );
    	bayleaf_get_template_partial( 'template-parts/meta', 'meta-author' );
    	printf( '<span class="meta-sep">%s</span>', esc_html__( 'Last updated', 'bayleaf' ) );
    	bayleaf_get_template_partial( 'template-parts/meta', 'meta-date' );
    }
    add_filter( 'bayleaf_markup_entry_meta', 'bayleaf_custom_entry_meta_fn' );

    Always backup your site before making changes in PHP.

    Please inform if you need more help on this OR any other help is required.

    Thanks

    Thread Starter Ebrark

    (@ebrark)

    Many Thanks for your reply.

    I get this error, when I add the above code to the child’s theme functions.php: There has been a critical error on your website.

    Below is how my functions.php file looks like without the above code:

    <?php
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    
    function enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    
    add_filter( 'get_the_archive_title', function ($title) {    
        if ( is_category() ) {    
                $title = single_cat_title( '', false );    
            } elseif ( is_tag() ) {    
                $title = single_tag_title( '', false );    
            } elseif ( is_author() ) {    
                $title = '<span class="vcard">' . get_the_author() . '</span>' ;    
            } elseif ( is_tax() ) { //for custom post types
                $title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
            }    
        return $title;    
    });
    
    /**
     * Adds categories to the pages.
     */
    
    function add_categories_to_pages() {
    register_taxonomy_for_object_type( 'category', 'page');
    }
    add_action( 'init' , 'add_categories_to_pages' );
    
    /**
     * New Entry meta function to include author avatar image.
     */
    function bayleaf_custom_entry_meta() {
    	global $post;
    	?>
    	<span<?php bayleaf_attr( 'meta-author-avatar' ); ?>>
    		<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID', $post->post_author ) ) ); ?>"<?php bayleaf_attr( 'url' ); ?>><span<?php bayleaf_attr( 'name', false ); ?>> <?php echo get_avatar( get_the_author_meta( 'user_email', $post->post_author ), 36 ); ?></span></a>
    	</span><!-- .meta-author -->
    	<?php
    	bayleaf_entry_meta();
    }
    
    /**
     * Modify entry meta callback function,
     */
    function bayleaf_custom_modify_entry_meta() {
    	return [ 'bayleaf_custom_entry_meta' ];
    }
    add_filter( 'bayleaf_markup_entry_meta', 'bayleaf_custom_modify_entry_meta' );
    
    /**
     * Move entry meta below title,
     */
    function bayleaf_custom_page_entry_header_items() {
    	return [
    		[ 'bayleaf_get_template_partial', 'template-parts/post', 'entry-title' ],
    		'bayleaf_entry_meta_wrapper',
    	];
    }
    add_filter( 'bayleaf_markup_page_entry_header_items', 'bayleaf_custom_page_entry_header_items' );
    Theme Author Veda

    (@vedathemes)

    Hi there,

    You are already using function ‘bayleaf_custom_entry_meta’ from https://www.ads-software.com/support/topic/author-name-with-picture-below-title/

    Please use any one of them. If you want to use code I mentioned above, please remove following code from your child theme,

    /**
     * New Entry meta function to include author avatar image.
     */
    function bayleaf_custom_entry_meta() {
    	global $post;
    	?>
    	<span<?php bayleaf_attr( 'meta-author-avatar' ); ?>>
    		<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID', $post->post_author ) ) ); ?>"<?php bayleaf_attr( 'url' ); ?>><span<?php bayleaf_attr( 'name', false ); ?>> <?php echo get_avatar( get_the_author_meta( 'user_email', $post->post_author ), 36 ); ?></span></a>
    	</span><!-- .meta-author -->
    	<?php
    	bayleaf_entry_meta();
    }
    
    /**
     * Modify entry meta callback function,
     */
    function bayleaf_custom_modify_entry_meta() {
    	return [ 'bayleaf_custom_entry_meta' ];
    }
    add_filter( 'bayleaf_markup_entry_meta', 'bayleaf_custom_modify_entry_meta' );

    It should remove the error message.

    Always backup your site before making changes in PHP.

    Please inform if you need more help on this.

    Thanks,

    Thread Starter Ebrark

    (@ebrark)

    Hello,

    I did remove the code you mentioned above from the functions.php. It removes Author image.

    Also since the new theme update, the child theme breaks posts and pages look:

      The heading has been aligned to the left.
      The Featured image is not in the middle.
      Posts/Pages text has moved to right.

    Did you introduce any new stylesheets ?

    Thanks

    Theme Author Veda

    (@vedathemes)

    Hi there,

    Can you provide your website URL, so that I can check and provide proper solution?

    Thanks,

    Theme Author Veda

    (@vedathemes)

    Hi there,

    Is there anything I can do to help you out?

    Thanks

    Thread Starter Ebrark

    (@ebrark)

    Hello,

    Sorry for late reply, currently stuck in China with VPN not working.

    Everything is working fine now.

    Thanks for all your help.

    Theme Author Veda

    (@vedathemes)

    You’re welcome. Take care of your health and stay protected from coronavirus.

    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Change in Date on Blog Post’ is closed to new replies.