• Hello,
    I’m using Co-Author Plus with the Magazine Plus theme and I’ve tried several ways to incorporate the co-authors to the theme without success. It turns out that all ByLine appears duplicate in the posts, one being inside the span tag for styling and one before the html tag. I do not know what’s going on and I need a lot of help solving that. Here is the code of Magazine Plus Posted On:

    
    if ( ! function_exists( 'magazine_plus_posted_on' ) ) :
    	/**
    	 * Prints HTML with meta information for the current post-date/time and author.
    	 */
    	function magazine_plus_posted_on() {
    		$show_meta_date   = true;
    		$show_meta_author = true;
    		$posted_on = '';
    		if ( true === $show_meta_date ) {
    			$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    			if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    				$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><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() )
    			);
    			$posted_on = sprintf(
    				'%s',
    				'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
    			);
    		}
    		$byline = '';
    		if ( true === $show_meta_author ) {
    
    			$byline = sprintf(
    				'%s',
    				'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
    			);
    		}
    
    		if ( ! empty( $posted_on ) ) {
    			echo '<span class="posted-on">' . $posted_on . '</span>'; // WPCS: XSS OK.
    		}
    		if ( ! empty( $byline ) ) {
    			// MODIFICADO
    			//echo '<span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
    			echo '<span class="byline"> ' . coauthors_posts_links() . '</span>'; // WPCS: XSS OK.
    		}
    	}
    endif;
    

    Very thanks for help!

    The page I need help with: [log in to see the link]

  • The topic ‘Duplicate ByLine in Magazine Plus’ is closed to new replies.