Difference between revisions of "Installing the Co-Authors Plus Wordpress Plugin"
Jump to navigation
Jump to search
(Created page with "==Installing the plugin== Just browse for it, install it, and enable it! Note that Co-Authors Plus has replaced all previous versions of the co-authors plugins. Its official...") |
|||
Line 7: | Line 7: | ||
See some instructions here: https://vip.wordpress.com/documentation/incorporate-co-authors-plus-template-tags-into-your-theme/ | See some instructions here: https://vip.wordpress.com/documentation/incorporate-co-authors-plus-template-tags-into-your-theme/ | ||
− | + | As we use a variant of the Accesspress-lite theme, we'll need to do some custom coding to make this work. | |
+ | |||
+ | First, to put the blog into debug mode so we can see errors uncomment the following in wp-config.php | ||
error_reporting(E_ALL); ini_set('display_errors', 1); | error_reporting(E_ALL); ini_set('display_errors', 1); | ||
define( 'WP_DEBUG', true); | define( 'WP_DEBUG', true); | ||
− | + | Then replace the old code with the replacement code in template_tags.php as follows: | |
− | Then replace the old code with the replacement code as follows: | ||
Old code from template_tags.php | Old code from template_tags.php |
Latest revision as of 12:58, 7 April 2017
Installing the plugin
Just browse for it, install it, and enable it! Note that Co-Authors Plus has replaced all previous versions of the co-authors plugins. Its official page is here: https://wordpress.org/plugins/co-authors-plus/
Adding the code to template_tags.php
See some instructions here: https://vip.wordpress.com/documentation/incorporate-co-authors-plus-template-tags-into-your-theme/
As we use a variant of the Accesspress-lite theme, we'll need to do some custom coding to make this work.
First, to put the blog into debug mode so we can see errors uncomment the following in wp-config.php
error_reporting(E_ALL); ini_set('display_errors', 1); define( 'WP_DEBUG', true);
Then replace the old code with the replacement code in template_tags.php as follows:
Old code from template_tags.php
if ( ! function_exists( 'accesspresslite_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function accesspresslite_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( __( '<span class="posted-on">Posted on %1$s</span><span class="byline"> by %2$s</span>', 'accesspresslite' ), 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;
Replacement code for template_tags.php
if ( ! function_exists( 'accesspresslite_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function accesspresslite_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() ) ); if ( function_exists( 'coauthors_posts_links' ) ) : printf( __( '<span class="posted-on">Posted on %1$s</span>', 'accesspresslite' ), sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>', esc_url( get_permalink() ), $time_string ) ); coauthors_posts_links (null,null,'<span class="byline"> by ','</span>'); else: printf( __( '<span class="posted-on">Posted on %1$s</span><span class="byline"> by %2$s</span>', 'accesspresslite' ), 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; } endif;