Support » Plugin: Co-Authors Plus » Doesn’t work with tewntyfifteen

  • There are no good installation instructions, they are old and the instructions don’t work with tewntyfifteen theme. You need to know lots of php to make it work. Its incredible that this functionality is not built in wordpress core system.

    Functions.php

    <?php
    // Exit if accessed directly
    if ( !defined( ‘ABSPATH’ ) ) exit;

    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED – Do not modify or remove comment markers above or below:

    if ( !function_exists( ‘chld_thm_cfg_parent_css’ ) ):
    function chld_thm_cfg_parent_css() {
    wp_enqueue_style( ‘chld_thm_cfg_parent’, trailingslashit( get_template_directory_uri() ) . ‘style.css’, array( ) );
    }
    endif;
    add_action( ‘wp_enqueue_scripts’, ‘chld_thm_cfg_parent_css’, 10 );

    // END ENQUEUE PARENT ACTION

    if ( ! function_exists( ‘twentyfifteen_posted_on’ ) ) :
    /**
    * Integrate Co-Authors Plus with TwentyTen by replacing twentyfifteen_posted_on() with this function
    */
    function twentyfifteen_posted_on() {
    if ( function_exists( ‘coauthors_posts_links’ ) ) :
    printf( __( ‘<span class=”%1$s”>Posted on</span> %2$s <span class=”meta-sep”>by</span> %3$s’, ‘twentyfifteen’ ),
    ‘meta-prep meta-prep-author’,
    sprintf( ‘<span class=”entry-date”>%3$s</span>‘,
    get_permalink(),
    esc_attr( get_the_time() ),
    get_the_date()
    ),
    coauthors_posts_links( null, null, null, null, false )
    );
    else:
    printf( __( ‘<span class=”%1$s”>Posted on</span> %2$s <span class=”meta-sep”>by</span> %3$s’, ‘twentyfifteen’ ),
    ‘meta-prep meta-prep-author’,
    sprintf( ‘<span class=”entry-date”>%3$s</span>‘,
    get_permalink(),
    esc_attr( get_the_time() ),
    get_the_date()
    ),
    sprintf( ‘<span class=”author vcard”>%3$s</span>’,
    get_author_posts_url( get_the_author_meta( ‘ID’ ) ),
    esc_attr( sprintf( __( ‘View all posts by %s’, ‘twentyfifteen’ ), get_the_author() ) ),
    get_the_author()
    )
    );
    endif;
    }
    endif;

    /**
    * Co-authors in RSS and other feeds
    * /wp-includes/feed-rss2.php uses the_author(), so we selectively filter the_author value
    */
    function db_coauthors_in_rss( $the_author ) {

    if ( !is_feed() || !function_exists( ‘coauthors’ ) )
    return $the_author;

    return coauthors( null, null, null, null, false );
    }
    add_filter( ‘the_author’, ‘db_coauthors_in_rss’ );

    Template_tag.php

    <?php
    /**
    * Outputs the co-authors display names, with links to their posts.
    * Co-Authors Plus equivalent of the_author_posts_link() template tag.
    *
    * @param string $between Delimiter that should appear between the co-authors
    * @param string $betweenLast Delimiter that should appear between the last two co-authors
    * @param string $before What should appear before the presentation of co-authors
    * @param string $after What should appear after the presentation of co-authors
    * @param bool $echo Whether the co-authors should be echoed or returned. Defaults to true.
    */
    function coauthors_posts_links( $between = null, $betweenLast = null, $before = null, $after = null, $echo = true ){
    return coauthors__echo(‘coauthors_posts_links_single’, ‘callback’, array(
    ‘between’ => $between,
    ‘betweenLast’ => $betweenLast,
    ‘before’ => $before,
    ‘after’ => $after
    ), null, $echo );
    }

    • This topic was modified 1 year, 10 months ago by  Florencia.
  • The topic ‘Doesn’t work with tewntyfifteen’ is closed to new replies.