WordPress.org

Forums

Flato
[resolved] Using Co-authors plus with Flato theme (2 posts)

  1. daveydream
    Member
    Posted 11 months ago #

    Hi,

    thanks for creating such a lovely theme.

    I'm trying to integrate the Co-authors plus plugin with Flato on a test site (http://test.daveydreamnation.com/), but I'm having trouble editing the themememe_posted_on() function in my child themes template-tags.php file so that the list of co-authors displays with the same style (i.e. with the little author icon next to the names).

    Here is what I have so far, I am not sure what I am doing wrong but any help much appreciated!

    if ( ! function_exists( 'themememe_posted_on' ) ) :
    /**
     * Integrate Co-Authors Plus with Flato by replacing themememe_posted_on() with this function
     */
    function themememe_posted_on() {
        if ( function_exists( 'coauthors_posts_links' ) ) :
            printf( __( '<span class="byline"><i class="fa fa-user"></i>%1$s</span><span class="posted-on"><i class="fa fa-calendar"></i>%2$s</span>', 'themememe' ),
    		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() )
    		),
                coauthors_posts_links( null, null, null, null, false )
            );
    
        else:
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$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( __( '<span class="byline"><i class="fa fa-user"></i>%1$s</span><span class="posted-on"><i class="fa fa-calendar"></i>%2$s</span>', 'themememe' ),
    		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() )
    		),
    		sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
    			esc_url( get_permalink() ),
    			$time_string
    		)
    	);
    }
    endif;
    }
    endif;
  2. daveydream
    Member
    Posted 10 months ago #

    Actually, I worked it out ...

    I just needed to replace the instance of

    <?php themememe_posted_on(); ?>

    in my content.php and content-single.php with

    <i class="fa fa-user"></i> <?php the_author(); ?>

    and that preserved the author icon.

    Simples! :-)

Reply

You must log in to post.

About this Theme

About this Topic